HAN! Posted October 16, 2007 Share Posted October 16, 2007 how to check if the e-mail adress is written in the right way in the form as www@www.www and if it is not to send an popup message to the user, thanxs Quote Link to comment https://forums.phpfreaks.com/topic/73471-solved-confirmation-email/ Share on other sites More sharing options...
MadTechie Posted October 16, 2007 Share Posted October 16, 2007 to check if its in the correct format.. <?php if (!preg_match('/^\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/si', $email)) { //invalid email, display message JS popup etc } ?> Quote Link to comment https://forums.phpfreaks.com/topic/73471-solved-confirmation-email/#findComment-370625 Share on other sites More sharing options...
HAN! Posted October 16, 2007 Author Share Posted October 16, 2007 well can javascript work with apache or is it aproblem? coz it is not working with me, no errors but no results too. Quote Link to comment https://forums.phpfreaks.com/topic/73471-solved-confirmation-email/#findComment-370634 Share on other sites More sharing options...
MadTechie Posted October 16, 2007 Share Posted October 16, 2007 apache !! JS is client side.. nothing to do with the server.. post your code Quote Link to comment https://forums.phpfreaks.com/topic/73471-solved-confirmation-email/#findComment-370636 Share on other sites More sharing options...
HAN! Posted October 16, 2007 Author Share Posted October 16, 2007 here is the code im using: <form name="insert" action="insert.php" method="post"> <table> <tr><td>First Name:</td><td><input type="text" name="first" /></td></tr> <tr><td>Midle Name:</td><td><input type="text" name="middle" /></td></tr> <tr><td>Familly Name:</td><td><input type="text" name="family" /></td></tr> <tr><td>Adress:</td><td><input type="text" name="adress" /></td></tr> <tr><td>Describe yourself:</td><td><textarea name="description"></textarea></td></tr> <tr><td>E-mail:</td><td><input type="text" name="Email" size="26" /> <input type="button" onclick="CheckEmail()></td></tr> <script language="javascript"> function CheckEmail() { email = document.insert.Email.value AtPos = email.indexOf("@") StopPos = email.lastIndexOf(".") Message = "" if (email == "") { Message = "Not a valid Email address" + "\n" } if (AtPos == -1 || StopPos == -1) { Message = "Not a valid email address" } if (StopPos < AtPos) { Message = "Not a valid email address" } if (StopPos - AtPos == 1) { Message = "Not a valid email address" } return message </script> <tr><td><input type="submit" /></td></tr> </table> </form> i will appreciate any comments. Quote Link to comment https://forums.phpfreaks.com/topic/73471-solved-confirmation-email/#findComment-370646 Share on other sites More sharing options...
MadTechie Posted October 16, 2007 Share Posted October 16, 2007 For JS try this.. <script language="javascript"> function CheckEmail() { email = document.insert.Email.value; Message = ""; if (!email.match(/^\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i)) { Message = "Not a valid email address"; } return message; </script> Quote Link to comment https://forums.phpfreaks.com/topic/73471-solved-confirmation-email/#findComment-370703 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.