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)); ??? Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.