mellowmuppet Posted February 15, 2008 Share Posted February 15, 2008 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 More sharing options...
paul2463 Posted February 15, 2008 Share Posted February 15, 2008 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 More sharing options...
mellowmuppet Posted February 15, 2008 Author Share Posted February 15, 2008 thanks for that i will definatly look at those. Link to comment https://forums.phpfreaks.com/topic/91230-validating-18-and/#findComment-467585 Share on other sites More sharing options...
redarrow Posted February 15, 2008 Share Posted February 15, 2008 here you go <?php $age=4; if( ($age >3) && ($age <15) ){ echo "correct age"; }else{ echo"incorect age"; } ?> Link to comment https://forums.phpfreaks.com/topic/91230-validating-18-and/#findComment-467610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.