Created
June 7, 2010 16:54
-
-
Save gavinblair/428909 to your computer and use it in GitHub Desktop.
HTML or array?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select name=”gender”> | |
<option value=”1”>Male</option> | |
<option value=”2”>Female</option> | |
</select> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select name="gender"> | |
<?php | |
$options = array(1 => "Male", 2 => "Female" ); | |
foreach($options as $oid => $option){ | |
echo "<option value='$oid'>$option</option>"; | |
} | |
?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@zoster says she would usually use an array if a select had more than three or four options.