Page 1 of 1
Controlling Forms
Posted: Tue Jun 25, 2002 7:44 pm
by Pintonite
I know I have seen it somewhere on this site but I need the code to be able to control the kind of information being passed in a form.
ie.
enter your birthdate: jeff
error message: that is not a birthdate, goofball.
thanks for the help
Posted: Tue Jun 25, 2002 10:23 pm
by protokol
this is standard form validation .. usually this is processed via a POST request sent by the browser .. there are many functions which can be useful, but the one you will probably want to learn is preg_match()
http://www.php.net/manual/en/function.preg-match.php
Posted: Wed Jun 26, 2002 1:57 am
by twigletmac
For specifically checking dates there is the
checkdate() function.
Mac
Posted: Wed Jun 26, 2002 4:10 am
by will
twigletmac wrote:For specifically checking dates there is the
checkdate() function.
Mac
just do keep in mind that checkdate() is
not y33k compliant

Posted: Wed Jun 26, 2002 9:26 am
by volka
"in the year 2525, if man is still alive, if woman can survive....."

*sorry, spam-only*
Posted: Wed Jun 26, 2002 1:22 pm
by Pintonite
Damn, I might not have explained myself good enough. I need to figure out how to make it so a person can only type in a valid number where numbers are supposed to go and/or a valid letter where letters are supposed to go in a form. perhaps I don't really understand
Posted: Thu Jun 27, 2002 1:42 am
by twigletmac
Well then, check out the is_something() functions. To start you off here's one that will check that a given value is numeric:
http://www.php.net/manual/en/function.is-numeric.php
Also as Protokol said the
preg_match() function will be very useful too.
Mac
Posted: Thu Jun 27, 2002 1:59 pm
by Pintonite
Thanks for the help.
I do understand now.