I have a script that will validate an email address & I think this is the only solution to validate emails on form submission? I end up with this script
<?php
if(isset($_POST['email']))
{
$email = $_POST['email'];
if (strpos($email, '@'))
{
$first = end(explode("@", $email));
if(checkdnsrr($first, 'MX'))
{
$validate = 'Valid email.';
}
else
{
$validate = 'Invalid email.';
}
}
else
{
$validate = 'Invalid email.';
}
echo $validate;
}
?>
<form method="POST">
<input type="text" name="email">
<input type="submit" value="submit">
</form>
It runs correctly but I have this error Strict standards: Only variables should be passed by reference.
Is there any way to remove the ERROR? and IMPROVE the code? Is there any email validation so far that is really validate emails?