I need to check if the input is a valid email or not if the email is not valid then it would ask again for the mail address without refreshing the whole page.
</script>
<?php
error_reporting(E_ALL);
if($_POST['submit']=="India")
{
if(isset($_POST['EMAIL']))
{ //only do file operations when appropriate
$a = $_POST['EMAIL'];
$myFile = "email_users.txt";
$d=date("d-m-y");
$r="\n";
$s=$_POST['submit'];
$fh = fopen($myFile, 'a+') or die("can't open file");
fwrite($fh, $a.','.$d.','.$s.','.$r);
fclose($fh);
}
}
if($_POST['sub']=="Overseas")
{
if(isset($_POST['EMAIL']))
{ //only do file operations when appropriate
$b = $_POST['EMAIL'];
$my = "email_users.txt";
$e=date("d-m-y");
$t="\n";
$u=$_POST['sub'];
$f = fopen($my, 'a+') or die("can't open file");
fwrite($f, $b.','.$e.','.$u.','.$t);
fclose($f);
}
}
//header("location:http://www.xyz.com");
?>
Please help me urgently
Thanks in advance