Having trouble creating functions to display a list of values in a drop down menu, all i want to display is the menu option, this will evetually be coded so that when the user selects the menu name, the menu is displyed in a text box and will be able to edit it.
<?php
function get_menus()
{
//query database
$conn = db_connect();
$query = "select menu_name
from menu
where menu_id = $menu_id";
$result = @mysql_query($query);
if (!$result)
return false;
$num_menus = @mysql_num_rows($result);
if ($num_menus == 0)
return false;
$result = mysql_result($result, 0, 'menu_name');
return $result;
}
function display_menu_form()
{
?>
<form method="post" action="">
<table align="center" border="0">
<tr>
<td><select name="menu_name">
<?php
//selects menu list from menu database
$menu_array=get_menus();
foreach ($menu_array as $menu)
{
echo '<option value="';
echo $menu['menu_name'];
echo '"';
}
?>
</select></td>
</tr>
</table>
</form>
<?php
}
?>