ksduded Posted September 12, 2008 Share Posted September 12, 2008 I am using an email variable from a form textfield to create a subdirectory. It only happens once the user hits the submit button on the form. Now if the user didn't enter the email address, my whole system will get messed up, and no one else will be able to use it. I need to create an email checker which checks it before the user hits the submit button. So it should check the email textfield right after the user enters in. Link to comment https://forums.phpfreaks.com/topic/123975-email-checker-before-submission/ Share on other sites More sharing options...
revraz Posted September 12, 2008 Share Posted September 12, 2008 Ok, so check it via a regular expression. Search for a email format checker. Link to comment https://forums.phpfreaks.com/topic/123975-email-checker-before-submission/#findComment-639997 Share on other sites More sharing options...
Stryves Posted September 12, 2008 Share Posted September 12, 2008 if(!$_POST['email']) { print "You did not enter a email, please go back and enter a email."; } Just change email to whatever you named the input form text area for email. Pretty basic though, it'll accept stuff like "email" which isn't a valid email address. Link to comment https://forums.phpfreaks.com/topic/123975-email-checker-before-submission/#findComment-639998 Share on other sites More sharing options...
ksduded Posted September 12, 2008 Author Share Posted September 12, 2008 Ok, so check it via a regular expression. Search for a email format checker. The email format checkers that I have seen only check it once the form has been submitted. I need to check it before it has been submitted. if(!$_POST['email']) { print "You did not enter a email, please go back and enter a email."; } Just change email to whatever you named the input form text area for email. Pretty basic though, it'll accept stuff like "email" which isn't a valid email address. I don't know how that will check it before submission. Do I place it right after the email textfield, before the submit button? Link to comment https://forums.phpfreaks.com/topic/123975-email-checker-before-submission/#findComment-640010 Share on other sites More sharing options...
Stryves Posted September 12, 2008 Share Posted September 12, 2008 Like this if(isset($_POST['submit'])) // checks to see if submit was pressed { if(!$_POST['email']) // if there is no email, it doesn't advance. { print "You did not enter a email, please go back and enter a email."; } else { $InsertQuery=mysql thingy // Your query to create the directories etc. } } else { // Form stuff where all the textfields and submit button are } Link to comment https://forums.phpfreaks.com/topic/123975-email-checker-before-submission/#findComment-640013 Share on other sites More sharing options...
ksduded Posted September 15, 2008 Author Share Posted September 15, 2008 i was having trouble incorporating a php checker, so i incorporated javascript. It works well in this scenario. Link to comment https://forums.phpfreaks.com/topic/123975-email-checker-before-submission/#findComment-642030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.