4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Two questions
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Kdawg
Senior WebHelper
Senior WebHelper


Joined: 21 Apr 2003
Posts: 153

PostPosted: Mon Apr 28, 2003 11:19 pm (20 years, 11 months ago) Reply with QuoteBack to Top

I got two questions both about php, is there a way to turn numbers into percents, like .21910 = 22%? Is there a way to check for posting fields, like if someone makes an html form and has 2 fields in it, the script will store the info of these 2 fields to 2 vaiables witout having to manually put $_POST[name] in the script?
OfflineView User's ProfileFind all posts by KdawgSend Personal Message
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Tue Apr 29, 2003 5:22 am (20 years, 11 months ago) Reply with QuoteBack to Top

To turn to percent:-

$number = 0.21910;
$percent_number = round($number*100);


question2:
what exactly do u want? the script should handle the $_POST[name] itself and write it to file without u having to code?
well, nice idea for research work to make a device that is attached to the brain and it writes the code for everything u think. cool stuff!!!

________________________________
Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
Kdawg
Senior WebHelper
Senior WebHelper


Joined: 21 Apr 2003
Posts: 153

PostPosted: Tue Apr 29, 2003 10:29 pm (20 years, 11 months ago) Reply with QuoteBack to Top

With the rounding is there a way to round to a certain place like .2919 = .292?
OfflineView User's ProfileFind all posts by KdawgSend Personal Message
SfCommand
Senior WebHelper
Senior WebHelper


Joined: 10 Nov 2002
Posts: 143
Location: UK

PostPosted: Tue Apr 29, 2003 10:43 pm (20 years, 11 months ago) Reply with QuoteBack to Top

Yes. To round .2919 to .292 you'd use
round(.2919, 3);

________________________________
Miguel

http://community.34sp.com
http://www.miguel.me.uk | http://www.sfcommand.co.uk | http://www.ssdg.org.uk
OfflineView User's ProfileFind all posts by SfCommandSend Personal MessageVisit Poster's Website
Kdawg
Senior WebHelper
Senior WebHelper


Joined: 21 Apr 2003
Posts: 153

PostPosted: Sat May 03, 2003 3:00 am (20 years, 11 months ago) Reply with QuoteBack to Top

how would I format the output of a number, like if it = 0.75 then it outputs .750?
OfflineView User's ProfileFind all posts by KdawgSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sat May 03, 2003 7:51 am (20 years, 11 months ago) Reply with QuoteBack to Top

Maybe this will be of help to you:

Arrow PHP: number_format

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Sat May 03, 2003 9:07 am (20 years, 11 months ago) Reply with QuoteBack to Top

printf("%0.3f",$number) can also do it

________________________________
Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.140892 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme