Thread: coding question
View Single Post
Old 01-17-2014, 03:21 PM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,053
Easy enough to make it display height as feet in the select box. However, unless you are going to change the program that is handling the form to handle it as feet , you want to keep what is passed into the program as inches still.



<label>Height:</label>
<select name="height" class="search_input">
<option value="">--select--</option>
<? for($i=58;$i<=73;$i++) {
?>
<option value="<?=$i;?>" <? if($rs['height']==$i) { echo "selected"; }?>>

// to show value as feet - decimal. ie: 126 inches displayed as 10.50

<?=number_format($i/12,2);?>

// to show as feet and inches ie: 126 inches = 10 feet 6 inches

<?=intval($i/12) . ' feet ' . ($i-(intval($i/12)*12)) . ' inches';?>

</option>
<? } ?>
</select>

Last edited by sarettah; 01-17-2014 at 03:27 PM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook