Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Stefan van Roosmalen
March 28, 2006, 7:05 pm
rate this thread
I am using a form to let the user enter an amount.
This must be with zero OR with 2 decimals.
I'm using the comma for decimal seperator.
How can I check if the input is valid (ereg or preg_match?) and what is the
exact statement I will have to use?
Please help me with this.
Re: validation on amount
(i.e. array( 0=>2,1=>10) ), it's quicker and easier to use intval() or
is_numeric() on each of the parts. If that doesn't suffice, what
exactly are your constraints (since validation is very important)?
Best/easiest way is to split the two values (decimal and whole number)
into separate form values.