Jump to content

validating < 18 and <2 characters


mellowmuppet

Recommended Posts

I dont know if anyone here is familiar with link directories and stuff like that but they always have a little script that stops you fom inputting less than say 3 character for your name.

 

Im trying to do a bit of validation so that when you enter your name it must be between 3 and 15 chars. As of yet i havent manged to get any reasonable results.

 

Also trying to do the same with age being < 18

 

Simple as possible please

 

here is the code i have so far.

 

If (empty($_GET['age'])) { echo "You must enter your age <br>"; }

else if ($_GET['name'] <= ('18',2));

 

???

 

 

Link to comment
https://forums.phpfreaks.com/topic/91230-validating-18-and/
Share on other sites

this should help with the <a href="http://uk.php.net/manual/en/function.strlen.php"> String Length </a> issue

 

and here should help with the <a href="http://www.developer.com/lang/php/article.php/947911"> Conditional Statements </a>

 

the manuals are great for finding things out like this

Link to comment
https://forums.phpfreaks.com/topic/91230-validating-18-and/#findComment-467572
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.