The following code can be used to generate a Select field as displayed in the image. It is done in core php.
<select name="height" required>
<option value="">Select</option>
for($inches=48;$inches<=78;$inches++) //Change the range in inches as required
{
$cm=ceil($inches*2.54);
$feet=(($inches-($inches % 12))/12)."’ ".($inches % 12)."”";
?>
<option value="<?php echo $cm; ?>"><?php echo $feet.' ('.$cm.' cms)'; ?></option>
<?php } ?>
</select>
Keywords: html form select options convert height length inch cm cms to feet
Comments