list/menu question<

liunx

Guest
ok I have a list/menu in a form and I want to have a selection already selected depending on information from another page how would I go about doing that?????When the list is created (I assume it's created via php), check for which one you want checked, and on that one, add this: selected="selected"
It would look like this:

<?php
$options = array("option1","option2","option3");
?>
<select name="day_of_week">
<?php
foreach($option as $cur_option){
echo " <option value=\"$cur_option\"";
if($cur_option == $_GET['info_from_prev_page']){echo " selected=\"selected\"";}
echo ">$cur_option</option>\r\n";
}
?>
</select>nope it is created by html in dreamweaverThen you should have something like this:<select name="day_of_week">
<option value="1"<?php if($_GET['info_from_prev_page'] == 'option1'){echo " selected=\"selected\"";} ?>>option1</option>
<option value="2"<?php if($_GET['info_from_prev_page'] == 'option2'){echo " selected=\"selected\"";} ?>>option2</option>
</select>
 
Back
Top