Validating email


/ Published in: PHP

This is a script for a validating Email.


Copy this code and paste it in your HTML
  1. ----------------------------------------------------------------------------------------------
  2.  
  3. function callEmailCheck() {
  4. 2
  5. var emailreg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  6. 3
  7. //useremail is the name of the email text field.
  8. 4
  9. var email = document.getElementById("useremail").value;
  10. 5
  11. if(emailreg.test(email) == true){
  12. 6
  13. return email;
  14. 7
  15. }
  16. 8
  17. return "";
  18. 9
  19. }
  20.  
  21.  
  22.  
  23. -----------------------------------------------------------------------------------------------

URL: http://katharnavas.wordpress.com/2009/10/20/email-validation-using-php-and-javascript/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.