E-Mail validation

Reply

Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

E-Mail validation

 
0
  #1
Jul 24th, 2008
Hello all,

I'm stuck in a serious problem, I need a code of Email validator in php. It will check whether there is a real email address or not, i.e it should not be "abcd@xyz.com" that means it will check the domain(yahoo.com, gmail.com, aol.com etc..) as well as the user id.....

PLZzzzzzzzzzzzzz help me it's realy very urgent.............

plzzzzzzzzzzz reply..................
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: E-Mail validation

 
0
  #2
Jul 24th, 2008
this is the code:
  1. var m = document.form1.emailid.value
  2. var cnt=0,spc=0,dot=0;
  3. for(var i=1;i<=m.length;i++)
  4. {
  5. if(m.charAt(i)=="@") cnt++;
  6. if(m.charAt(i)==" ") spc++;
  7. if(m.charAt(i)==".") dot++;
  8. }
  9. lnm=m.length
  10. if(cnt==0||cnt>1||spc!=0||dot==0 ||lnm<=2 ) {alert("Please Enter Valid E-mail Id ");document.form1.emailid.focus();return false; }
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: E-Mail validation

 
0
  #3
Jul 24th, 2008
Plz... check out this url.........
I just want this method in php...

http://www.coveryourasp.com/ValidateEmail.asp#Result2
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: E-Mail validation

 
0
  #4
Jul 24th, 2008
I've done this way but its not working....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
var m = document.form1.emailid.value
var cnt=0,spc=0,dot=0;
for(var i=1;i<=m.length;i++)
{
if(m.charAt(i)=="@") cnt++;
if(m.charAt(i)==" ") spc++;
if(m.charAt(i)==".") dot++;
}
lnm=m.length
if(cnt==0||cnt>1||spc!=0||dot==0 ||lnm<=2 ) {
alert("Please Enter Valid E-mail Id ");
document.form1.emailid.focus();
return false;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="Level1_Verdana.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form name="form1" action="<?php $PHP_SELF;?>" method="post">
<label>Emaiil :
<input name="emailid" type="text" id="emailid" />
</label>
<input type="submit" name="enter" value="Enter" />

</form>
</body>
</html>
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: E-Mail validation

 
0
  #5
Jul 24th, 2008
i changed your code...
its corectly working now:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <script language="javascript">
  5. function check()
  6. {
  7. var m = document.form1.emailid.value
  8. var cnt=0,spc=0,dot=0;
  9. for(var i=1;i<=m.length;i++)
  10. {
  11. if(m.charAt(i)=="@") cnt++;
  12. if(m.charAt(i)==" ") spc++;
  13. if(m.charAt(i)==".") dot++;
  14. }
  15. lnm=m.length
  16. if(cnt==0||cnt>1||spc!=0||dot==0 ||lnm<=2 ) {
  17. alert("Please Enter Valid E-mail Id ");
  18. document.form1.emailid.focus();
  19. return false;
  20. }
  21. }
  22. </script>
  23. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  24. <title>Untitled Document</title>
  25. <link href="Level1_Verdana.css" rel="stylesheet" type="text/css" />
  26. </head>
  27.  
  28. <body>
  29. <form name="form1" action="" method="post" onsubmit="return check()">
  30. <label>Emaiil :
  31. <input name="emailid" type="text" id="emailid" />
  32. </label>
  33. <input type="submit" name="enter" value="Enter" />
  34.  
  35. </form>
  36. </body>
  37. </html>
error was:
you didnt cal any function in your form tag...
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 9
Reputation: us12 is an unknown quantity at this point 
Solved Threads: 2
us12's Avatar
us12 us12 is offline Offline
Newbie Poster

Re: E-Mail validation

 
0
  #6
Jul 24th, 2008
  1. hai u can use this validation code it will accept mail id in the form of aa@aa.aa<body>
  2. <script type="text/javascript">
  3.  
  4. /***********************************************
  5. * Email Validation script- © Dynamic Drive (www.dynamicdrive.com)
  6. * This notice must stay intact for legal use.
  7. * Visit http://www.dynamicdrive.com/ for full source code
  8. ***********************************************/
  9.  
  10. var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
  11. function checkmail(e){
  12. var returnval=emailfilter.test(e.value)
  13. if (returnval==false){
  14. alert("Please enter a valid email address.")
  15. e.select()
  16. }
  17. return returnval
  18. }
  19.  
  20. </script>
  21.  
  22. <form>
  23. <input name="myemail" type="text" style="width: 270px"> <input type="submit" onClick="return checkmail(this.form.myemail)" value="Submit" />
  24.  
  25. </form>
  26.  
  27. </body>
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: E-Mail validation

 
0
  #7
Jul 24th, 2008
Hi Shanti,

ya now its working fine but it still accepting asasasasas@asasasasasa.com

I need a validator which will check either it is a real valid mail id or not

Thanx 4 rply.......

but the problem still not figured out...

have a look on the specified url
http://www.coveryourasp.com/ValidateEmail.asp#Result2
Last edited by nil_gh_80; Jul 24th, 2008 at 3:55 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC