I have a page where a user posts a dollar amount. However, I had always assumed the user would enter a dollar amount without commas, decimal places, or dollar signs...I was wrong.
How can I check there input and remove any of these rogue characters?
I am using the post method on the frontpage form. Thanks
For instance...suppose they enter: $200,000.00
I want a variable to just take the integer value: $input=200000;
Post Variables with commma
Moderator: General Moderators
-
timclaason
- Forum Commoner
- Posts: 77
- Joined: Tue Dec 16, 2003 9:06 am
- Location: WI
Post Variables with commma
Last edited by timclaason on Tue Dec 16, 2003 9:12 am, edited 2 times in total.
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
not sure what you want, so heres some ideas
$_POST['money'];
$_SESSION['money';
http://uk.php.net/setcookieset cookie() function
if your having a problem with certain values not passing use a . before them
like .$_SESSION, this as i am reliably told, exits a string to go to a variable and back again, you can find complex explanations on google or here
hope this gives you some ideas
$_POST['money'];
$_SESSION['money';
http://uk.php.net/setcookieset cookie() function
if your having a problem with certain values not passing use a . before them
like .$_SESSION, this as i am reliably told, exits a string to go to a variable and back again, you can find complex explanations on google or here
hope this gives you some ideas
try this
Mark
Code: Select all
$money_without_commas = str_replace ( ",", "", $_POST['money']);-
timclaason
- Forum Commoner
- Posts: 77
- Joined: Tue Dec 16, 2003 9:06 am
- Location: WI
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK