What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Dynamically changing text box, based on a form input?

Dynamically changing text box, based on a form input?
Author: Message:
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
34 / Male / Flag
Joined: Aug 2005
RE: Dynamically changing text box, based on a form input?
php code:
$am = $_POST['amount'];
$ret = ceil($am/0.05);

EDIT:

NB: ceil rounds up to nearest integer value, which I assumed from your post. However, if you needed to round up such that you end up to the nearest pence/cent, you'd have to use round() and an appropriate precision value, along with adding 0.005 to ensure you end up with the correct rounded up value...

php code:
$am = $_POST['amount'];
$ret = round(($am/0.05)+0.005, 2);

EDIT 2:

Thinking about it, dividing an integer with no more than 2 dp by 0.05 (effectively multiplying by 20) will mean there will be at most 1dp, so that last edit can be ignored, but kept for reference :P

This post was edited on 02-07-2010 at 10:26 PM by stoshrocket.
formerly methos
02-07-2010 10:14 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Dynamically changing text box, based on a form input? - by Jimbo on 02-07-2010 at 09:37 PM
RE: Dynamically changing text box, based on a form input? - by Chrissy on 02-07-2010 at 10:07 PM
RE: Dynamically changing text box, based on a form input? - by stoshrocket on 02-07-2010 at 10:14 PM
RE: Dynamically changing text box, based on a form input? - by Jimbo on 02-07-2010 at 11:03 PM
RE: Dynamically changing text box, based on a form input? - by Spunky on 02-07-2010 at 11:44 PM
RE: Dynamically changing text box, based on a form input? - by Jimbo on 02-08-2010 at 12:15 AM
RE: Dynamically changing text box, based on a form input? - by Spunky on 02-08-2010 at 12:22 AM
RE: Dynamically changing text box, based on a form input? - by stoshrocket on 02-08-2010 at 12:36 AM
RE: Dynamically changing text box, based on a form input? - by Jimbo on 02-08-2010 at 12:37 AM
RE: Dynamically changing text box, based on a form input? - by Spunky on 02-08-2010 at 12:40 AM
RE: Dynamically changing text box, based on a form input? - by Jimbo on 02-08-2010 at 01:08 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On