coolphpdude Posted August 13, 2008 Share Posted August 13, 2008 Hi there, I have a 3 part problem which i need to get sorted ASAP. Ive been told by my uni tutor that i need to include this in my project! Firstly i have a text field for a user to enter their email address upon registration... but i have no validation to find out if an @ sign has been entered or a dot (.) before the com or co.uk, etc. Is this easy to do and can someone tell me how to do it or point me in the right direction to find out? I'm also getting wrong for not getting an email sent to the user upon registration (which i obviously can't do until i've confirmed the email address is in the correct format) for the user to click a link to activate their account. So how do i do this? Could anyone explain or point me in the right direction? Cheers Link to comment https://forums.phpfreaks.com/topic/119441-validating-an-email-address-has-been-entered-into-a-text-field/ Share on other sites More sharing options...
MasterACE14 Posted August 13, 2008 Share Posted August 13, 2008 try this: <?php if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $_POST["email"])) die("<center>Invalid e-mail address!</center>"); Link to comment https://forums.phpfreaks.com/topic/119441-validating-an-email-address-has-been-entered-into-a-text-field/#findComment-615305 Share on other sites More sharing options...
coolphpdude Posted August 13, 2008 Author Share Posted August 13, 2008 i'l give it a try Link to comment https://forums.phpfreaks.com/topic/119441-validating-an-email-address-has-been-entered-into-a-text-field/#findComment-615307 Share on other sites More sharing options...
coolphpdude Posted August 13, 2008 Author Share Posted August 13, 2008 Hi thanks, that code works! could you break it down and explain it to me so i understandhow it works? Link to comment https://forums.phpfreaks.com/topic/119441-validating-an-email-address-has-been-entered-into-a-text-field/#findComment-615321 Share on other sites More sharing options...
coolphpdude Posted August 13, 2008 Author Share Posted August 13, 2008 Well at least i've got that bit anyway! Ok, next question... how do i send an email to that address automatically to get the new user to click a link and activate their account? Link to comment https://forums.phpfreaks.com/topic/119441-validating-an-email-address-has-been-entered-into-a-text-field/#findComment-615336 Share on other sites More sharing options...
MasterACE14 Posted August 13, 2008 Share Posted August 13, 2008 Hi thanks, that code works! could you break it down and explain it to me so i understandhow it works? I honestly don't understand that stuff lol. I found it somewhere at some point and have used it ever since. and as for the emailing. look into the mail(); function on php.net Link to comment https://forums.phpfreaks.com/topic/119441-validating-an-email-address-has-been-entered-into-a-text-field/#findComment-615420 Share on other sites More sharing options...
coolphpdude Posted August 14, 2008 Author Share Posted August 14, 2008 ahh, cheers for your help, much appreciated!! Link to comment https://forums.phpfreaks.com/topic/119441-validating-an-email-address-has-been-entered-into-a-text-field/#findComment-616259 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.