Forum Moderators: coopster
I am doing dynamic menu list. It takes a list from DB.
And when I select an item in menu. It should submit the value and load C file.
I cant get the menu selected item be displayed after submission.
Here is the code
<form name="form2" method="post" action="<? $_SERVER <select name="events_list" size="1" id="events_list" onchange="submit()">
<option value="zero"> Please select the event </option>
<?
while($row = mysql_fetch_array( $sql2 )) {
echo " <option value=\" $row[0]\" ";
if ($_POST['events_list']) { // see if List menu is selected
$event_id = $_POST['events_list'];
}
if ( $row[0]== strval$event_id) { //THIS IS NOT WORKING
echo "selected";
}
echo "> $event_id.$row[1] </option>";
}
?>
</select>
</div>
</form>
because I use this one on multiple pages, I also user $_SERVER['DOCUMENT_ROOT'] to determine the requesting scripts name to determine what $currency_selected should contain, a value from a field received from a query or a simple $_POST value, like is included in the example. I left the rest out for your ease of understanding it :) Its inside a file, which I include and I use the selector like: <? echo $currency_selector;?>
thats about it :)