![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Jul 2006
Location: Toronto Canada
Posts: 563
|
coding question
on a form this code is for height in inches how can i make it to display in feet ,thanks
<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"; }?>> <?=$i;?> </option> <? } ?> </select> |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#2 |
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> |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#3 | |
Confirmed User
Join Date: Jul 2006
Location: Toronto Canada
Posts: 563
|
Quote:
the code for the people to add their profile to the site is <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"; }?>> <?=$i;?> </option> <? } ?> </select> and the code on the actual profile page visible to public is <p>Height: <?=$detail['height'];?> how do i make that ^ display as feet? Thanks! edit it used your code as this on the create profile page and it changed it to feet now to get the profile to display in feet thanks! <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"; }?>> <?=intval($i/12) . ' feet ' . ($i-(intval($i/12)*12)) . ' inches';?> </option> |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#4 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,053
|
Quote:
intval($height/12) . ' feet ' . ($height-(intval($height/12)*12)) . ' inches'; |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#5 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,053
|
Quote:
<?=intval($detail['height']/12) . ' feet ' . ($detail['height']-(intval($detail['height']/12)*12)) . ' inches';?> Where you have: <?=$detail['height'];?> Hate when I screw up ![]() |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Jul 2006
Location: Toronto Canada
Posts: 563
|
it works!
Thanks very much you rock! ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#7 |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,053
|
|
![]() |
![]() ![]() ![]() ![]() |