Cless Posted June 30, 2007 Share Posted June 30, 2007 Hello, How is it possible to make it so, on a registration form, if someone doesn't enter a required amount of characters, it makes it so they can't continue to Register (they must try again)? Thanks. Quote Link to comment Share on other sites More sharing options...
AndyB Posted June 30, 2007 Share Posted June 30, 2007 http://ca.php.net/manual/en/function.strlen.php Quote Link to comment Share on other sites More sharing options...
metrostars Posted June 30, 2007 Share Posted June 30, 2007 You could use the script like if(strlen($_POST['username']) <= 5) {echo "You must enter at least 5 characters for the username";} else { if(strlen($_POST['password']) <= 5) {echo "You must enter at least 5 characters for the password";} else { continue registration; }} or if you want the same error for each one, if(strlen($_POST['username']) <= 5 || strlen($_POSt['password']) <= 5) {echo "There is a problem with registation";} else { continue script; } Quote Link to comment Share on other sites More sharing options...
Cless Posted June 30, 2007 Author Share Posted June 30, 2007 Ah, so that's what strlen can be used for. My friend and I thought it had barely any point. Hmm, I'll try it, metrostars. Thanks. Awesome. It worked perfectly. Thank you. Solved. 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.