Mythic Fr0st Posted December 1, 2006 Share Posted December 1, 2006 Well, Im making a signup page, and I need to check that the username & password is greater than 4 characters, I need it to highlight the actual name of the box in which there was an errorE.GUsername: Pue[color=red]Username[/color]:I also need it to confirm that email text is equal to confirm emails text, I have an idea on how to do this but not 100% sureany help appreciated Quote Link to comment https://forums.phpfreaks.com/topic/29151-need-help-with-username-password-lengths-and-checking-email-confirm-email/ Share on other sites More sharing options...
keeB Posted December 1, 2006 Share Posted December 1, 2006 do you want to do this when the page is submitted (i.e in submit.php) or have validation before the submit.php? Quote Link to comment https://forums.phpfreaks.com/topic/29151-need-help-with-username-password-lengths-and-checking-email-confirm-email/#findComment-133661 Share on other sites More sharing options...
Mythic Fr0st Posted December 1, 2006 Author Share Posted December 1, 2006 WOH! you mean you can check before it sends?Im using $_POST['name'] on another page, but its not working to well, (Trying to check if 2 entered boxes are equal)Can you tell me how to validate it before page changes, so incase they're not right, it doesnt...:) Quote Link to comment https://forums.phpfreaks.com/topic/29151-need-help-with-username-password-lengths-and-checking-email-confirm-email/#findComment-133668 Share on other sites More sharing options...
kickassamd Posted December 1, 2006 Share Posted December 1, 2006 [code]<?$name = $_POST['name'];$name2 = $_POST['name2'];// Check For Matchif ($name != $name2){ echo "The username you entered does not match! Try again...";}// Check Lengthelseif (strlen($name) < 4){ echo "The username you is too short. Try again...";}?>[/code]Try this, should work just change the second $_POST['name2'] to the name of your second form field. I'd recommend javascript though... Quote Link to comment https://forums.phpfreaks.com/topic/29151-need-help-with-username-password-lengths-and-checking-email-confirm-email/#findComment-133703 Share on other sites More sharing options...
Philip Posted December 1, 2006 Share Posted December 1, 2006 You can use javascript to check to see if they are correct before submitting the page - warning box will popup and say "____ Fields do not match"Or if you wanted to check to see if the username/email/whatever is already in a database, you could use AJAX which is a little more complex Quote Link to comment https://forums.phpfreaks.com/topic/29151-need-help-with-username-password-lengths-and-checking-email-confirm-email/#findComment-133707 Share on other sites More sharing options...
Mythic Fr0st Posted December 2, 2006 Author Share Posted December 2, 2006 Thanks guys, thanks alot Quote Link to comment https://forums.phpfreaks.com/topic/29151-need-help-with-username-password-lengths-and-checking-email-confirm-email/#findComment-133751 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.