metomeya
02-21-2010, 10:17 PM
Hi,
I really new to Php and I'm probably over my head, haha.
I'm trying to have a drop box from a SQL database that is organized in alphabetical order. Here is my code for php:
$sql_unit="SELECT UnitID, UnitName FROM unit";
$result_unit=mysql_query($sql_unit);
$unit_options="";
while ($row=mysql_fetch_array($result_unit))
{
$unitid=$row["UnitID"];
$unitname=$row["UnitName"];
$unit_options.="<OPTION VALUE=\"$unitid\">".$unitname;
}
And the html code below it
<form>
<select name="remove_unit">
<option><?php echo $unit_options?></option>
</select>
<input type="button" value="Remove" />
</form>
But here is the thing, I need to be able to remove the selected item from the database. Which I don't know how to do....what how I need to structure this?
Thanks!
I really new to Php and I'm probably over my head, haha.
I'm trying to have a drop box from a SQL database that is organized in alphabetical order. Here is my code for php:
$sql_unit="SELECT UnitID, UnitName FROM unit";
$result_unit=mysql_query($sql_unit);
$unit_options="";
while ($row=mysql_fetch_array($result_unit))
{
$unitid=$row["UnitID"];
$unitname=$row["UnitName"];
$unit_options.="<OPTION VALUE=\"$unitid\">".$unitname;
}
And the html code below it
<form>
<select name="remove_unit">
<option><?php echo $unit_options?></option>
</select>
<input type="button" value="Remove" />
</form>
But here is the thing, I need to be able to remove the selected item from the database. Which I don't know how to do....what how I need to structure this?
Thanks!