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.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 01-17-2014, 02:02 PM   #1
Ketchup
Confirmed User
 
Ketchup's Avatar
 
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>
Ketchup is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 01-17-2014, 03:21 PM   #2
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
Old 01-17-2014, 04:14 PM   #3
Ketchup
Confirmed User
 
Ketchup's Avatar
 
Join Date: Jul 2006
Location: Toronto Canada
Posts: 563
Quote:
Originally Posted by sarettah View Post
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.
thanks for your help yes that is what I am trying to do is make it display in feet in the profile page

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>

Last edited by Ketchup; 01-17-2014 at 04:23 PM..
Ketchup is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 01-17-2014, 04:41 PM   #4
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,053
Quote:
Originally Posted by Ketchup View Post
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!
Same as we did the select, just divide height by 12 (12 inches in a foot) and then get the remainder for the left over inches:

intval($height/12) . ' feet ' . ($height-(intval($height/12)*12)) . ' inches';
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 01-17-2014, 05:13 PM   #5
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,053
Quote:
Originally Posted by sarettah View Post
Same as we did the select, just divide height by 12 (12 inches in a foot) and then get the remainder for the left over inches:

intval($height/12) . ' feet ' . ($height-(intval($height/12)*12)) . ' inches';
Actually that should be:

<?=intval($detail['height']/12) . ' feet ' . ($detail['height']-(intval($detail['height']/12)*12)) . ' inches';?>

Where you have:

<?=$detail['height'];?>

Hate when I screw up
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 01-17-2014, 05:45 PM   #6
Ketchup
Confirmed User
 
Ketchup's Avatar
 
Join Date: Jul 2006
Location: Toronto Canada
Posts: 563
it works!

Thanks very much you rock!
Ketchup is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 01-19-2014, 11:59 AM   #7
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,053
Quote:
Originally Posted by Ketchup View Post
it works!
You sound surprised?


Quote:
Thanks very much you rock!
np
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.