Hi i would be grateful if someone can help me with this, I think i know what is wrong but i don't know how to fix it. I am trying to repopulate this drop down menu from the mysql db so that the new values can be selected again...
i get this error...
Notice: Undefined variable: menuexample in C:\Program Files\Apache Group\Apache2\htdocs\prop_manager\prop_search_form.php on line 117
IN the drop down box this error occurs..
Undefined offset:1 in C:\ ......bla bla bla ...on line 137
here is the code:
<?php
$query = "SELECT city FROM right_prop_1";
$city="menuexample";
$selected_value=$menuexample;
$topoption = 'Select an option';
selectmenu($selected_value,$query,$city,$topoption);
function selectmenu($selected_value,$query,$city,$topoption)
{
$result = mysql_query($query);
echo '<select name="'.$city.'">';
echo '<option> ---'.$topoption.' --- </option>';
while($row = mysql_fetch_array($result))
{
echo '<option value="';
echo $row[0];
echo '" ';
if($row[0]==$selected_value)
{
echo 'selected';
}
echo '>';
echo $row[1];
echo '</option>';
}
echo '</select>';
}
?>