This is javascript code, needs to be added to html:
function validate(form_id,email_address) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.forms[form_id].elements.email_address].value;
if(reg.test(address) == false) {
alert(‘Please, enter correct email’);
return false;

And this is form html code
<form id=”form_id” method=”post” action=”your_some_file.php” onsubmit=”javascript:return validate(‘form_id’,’email’);”>
<input type=”text” id=”email” name=”email” />
<input type=”submit” value=”Submit” />

Useful links:,

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>