I’ve created that a drop down that shows the selected value for editing but allows for selection if adding to the database.
Im trying to add an option in there with a value of nothing, if something inthe drop down isnt selected.
Hope you know what I mean.
Here is my code:
<select name="pcats" size="1">
<?php $qw=mysql_query("select cat_Id, category_Name from category order by category_Name ASC") or die (mysql_error());
while($r=mysql_fetch_assoc($qw))
{
if($r['cat_Id']==$pcats)
{
echo "<option value='$r[cat_Id]' selected>$r[category_Name]</option>";
}
else
{
echo "<option value='$r[cat_Id]'>$r[category_Name]</option>";
}
}
?>
</select>
The empty option need to go in the second echo.