metomeya
02-22-2010, 01:16 AM
Hi,
This is sort of a follow up to my last post
I was wondering the best/easiest way to make dynamic drop boxes. Do I need to use Javascript?
Here is some of the code I'm working with. I want select a meal type (breakfast, lunch, dinner, etc.) and then have the subsequent drop box pull up only the relevant meals
$sql_mealtype="SELECT typeID, typeName FROM mealtypes ORDER BY typeID";
$result_mealtype=mysql_query($sql_mealtype);
$mealtype_options="";
while ($row=mysql_fetch_array($result_mealtype))
{
$typeid=$row["typeID"];
$typename=$row["typeName"];
$type_options.="<OPTION VALUE=\"$typeid\">".$typename;
}
<form>
Meal Type:
<br>
<select name="remove_type">
<option><?php echo $type_options?></option>
</form>
<form>
Recipe:
<br>
<select>
<option>#####</option>
</select>
</form>
This is sort of a follow up to my last post
I was wondering the best/easiest way to make dynamic drop boxes. Do I need to use Javascript?
Here is some of the code I'm working with. I want select a meal type (breakfast, lunch, dinner, etc.) and then have the subsequent drop box pull up only the relevant meals
$sql_mealtype="SELECT typeID, typeName FROM mealtypes ORDER BY typeID";
$result_mealtype=mysql_query($sql_mealtype);
$mealtype_options="";
while ($row=mysql_fetch_array($result_mealtype))
{
$typeid=$row["typeID"];
$typename=$row["typeName"];
$type_options.="<OPTION VALUE=\"$typeid\">".$typename;
}
<form>
Meal Type:
<br>
<select name="remove_type">
<option><?php echo $type_options?></option>
</form>
<form>
Recipe:
<br>
<select>
<option>#####</option>
</select>
</form>