hoponhiggo Posted July 31, 2011 Share Posted July 31, 2011 Hi I am trying to expand on my current form validation code which is basic to say the least. the following code part of my registration form. //form validation starts here if(isset($_POST['username'])){ if($_POST['username'] == ""){ //username empty die("You must enter a username"); } } else { //username not set } if(isset($_POST['password'])){ if($_POST['password'] == ""){ //password empty die("You must enter a password"); } } else { //password not set } How can i expand on this to a)echo the error messages on the same page? b)ensure that passwords are a minimum amounts of characters? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/243365-form-validation-help/ Share on other sites More sharing options...
voip03 Posted July 31, 2011 Share Posted July 31, 2011 If you google it, you will get lot of info. http://www.html-form-guide.com/php-form/php-registration-form.html http://www.learnphponline.com/scripts/email-activation-for-php-forms Quote Link to comment https://forums.phpfreaks.com/topic/243365-form-validation-help/#findComment-1249757 Share on other sites More sharing options...
IrOnMaSk Posted August 3, 2011 Share Posted August 3, 2011 i would put form in same file with the php file... and start out by hiding the form... so do the if statement like what you do and reveal the form when the condition is not met... let me know if need help wit the code part Quote Link to comment https://forums.phpfreaks.com/topic/243365-form-validation-help/#findComment-1251508 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.