I have a form that reads in an email address. I get things like name@yaoo.com. I would like to catch these common mistakes and correct them. However, sometimes the thing I'm looking at is correctly typed on the left side of the @. So if someone has a valid yaoo@yahoo.com I don't want to make this replacement. So, I only want to look at what is on the right side of the @. I have tried including the @ in my compare/replace but that doesn't seem to work at all. Any ideas how I might do this?
$action = "first";
if (isset ($_POST['action']))
$action = $_POST['action'];
if ($action == 'first') {
print "<form method='post' action='fixResource.php'>";
print "<input type='text' name='emailIn' value='$emailIn'>\n";
print "<input type='hidden' name='action' value='second'>\n";
print "<input TYPE='SUBMIT' NAME='Agree' VALUE='Give this a try'>\n";
}
if ($action == 'second') {
$email = $_POST['emailIn'];
$email = str_ireplace('@yaoo','@yahoo',$email,$change);
if ($change > 0)
print "Warning - email address has been changed.<br><br>";
}