| | |
E-Mail validation
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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..................
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..................
this is the code:
javascript Syntax (Toggle Plain Text)
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; }
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Plz... check out this url.........
I just want this method in php...
http://www.coveryourasp.com/ValidateEmail.asp#Result2
I just want this method in php...
http://www.coveryourasp.com/ValidateEmail.asp#Result2
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>
<!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>
i changed your code...
its corectly working now:
error was:
you didnt cal any function in your form tag...
its corectly working now:
php Syntax (Toggle Plain Text)
<!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"> function check() { 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="" method="post" onsubmit="return check()"> <label>Emaiil : <input name="emailid" type="text" id="emailid" /> </label> <input type="submit" name="enter" value="Enter" /> </form> </body> </html>
you didnt cal any function in your form tag...
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
PHP Syntax (Toggle Plain Text)
hai u can use this validation code it will accept mail id in the form of aa@aa.aa<body> <script type="text/javascript"> /*********************************************** * Email Validation script- © Dynamic Drive (www.dynamicdrive.com) * This notice must stay intact for legal use. * Visit http://www.dynamicdrive.com/ for full source code ***********************************************/ var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i function checkmail(e){ var returnval=emailfilter.test(e.value) if (returnval==false){ alert("Please enter a valid email address.") e.select() } return returnval } </script> <form> <input name="myemail" type="text" style="width: 270px"> <input type="submit" onClick="return checkmail(this.form.myemail)" value="Submit" /> </form> </body>
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
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.
![]() |
Similar Threads
- Need Email validation source code (C#) (C#)
- Simple JavavScript needs email validation (JavaScript / DHTML / AJAX)
- how to check mail address is exists or not (ASP.NET)
- Javascript, Form fields validation and submit (JavaScript / DHTML / AJAX)
- form validation not working (JavaScript / DHTML / AJAX)
- need help with e-mail validation(asp) (ASP)
Other Threads in the PHP Forum
- Previous Thread: Delete Operation
- Next Thread: Python and PHP integration help: Incorrect Image URL decode?
| Thread Tools | Search this Thread |
# 5.2.10 access action address alexa apache api array auto autoincrement broken cakephp checkbox class classes clean clients cms code cron curl database date dehasher destroy directory dissertation domain dynamic echo$_get[x]changingitintovariable... email encode error errorlog fairness fatalerror file folder form function functions google href htaccess html image include indentedsubcategory ip javascript joomla legislation limit link load local login masterthesis memberships menu multiple multipletables mysql mysqlquery newsletters oop open passwords paypal pdf persist php popup provider query radio random script search secure server sessions simple sockets source space spam sql system table tutorial upload url user variable video voteup web youtube






