Created
July 20, 2016 06:36
-
-
Save RandomArray/ecadf7a8c42195a5f3c37a7585e0cb76 to your computer and use it in GitHub Desktop.
Generates HTML Select box for person's height in inches.
This file contains 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
<?php | |
function personHeightOptions(){ | |
$itotal = 95; $r = ''; | |
for($foot=7;$foot>=3;$foot--){ | |
for($inches=11;$inches>=0;$inches--){ | |
if($inches==0){ | |
$r .= "<option value='$itotal'> $foot' 0\" </option>"; | |
}else{ | |
$r .= "<option value='$itotal'> $foot' $inches\" </option>"; | |
} | |
$itotal--; | |
} | |
} | |
return $r; | |
} | |
?> | |
<select name="person_height" id="person_height"> | |
<option disabled selected>Height</option> | |
<?php echo personHeightOptions(); ?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment