I have this
<form name="myform" action="action.php" method="post">
<select name="myoptions">
<option value="option1">option1</option>
<option value="option2">option2</option>
<option value="option3">option3</option>
<option value="option4">option4</option>
<option value="option5">option5</option>
</select>
</form>
And i want to apply the following code on it(gratefully provided by Byron3@earthlink),
how would i integrate this?
function DisplayMenuChoices( $selected ="") {
$list = array( "option1",
"option2",
"option3",
"option4",
"option5"
);
echo "<select name='myoptions '>\n";
foreach ( $list as $name ) {
if ( $name == $selected ){
echo " <option selected='selected'>$name</option>\n";
} else {
echo " <option>" .$name. "</option>\n";
}
}
echo "</select>\n"; // End select list
}
I would prefer this method,if it does not generate duplicates
Appreciate your support





Bookmarks