I am trying to send an email to myself when an error happens from filling out the php form -
i trying send email myself when error happens filling out php form instead of doing print="sorry error happened"
$error = "error happened".$order."\r\n"; $error_email = mail($to, $subject, $error, $headers2); $mail = @mail($email, $subject, $confirmation, $headers2); if ($mail) { header("location: http://www.test.com" ); } else ($error_email);
you're not using brackets after else.
if($mail) { header("location: http://www.test.com"); } else { mail($to, $subject, $error, $headers2); echo $error; }
and never using echo $error error couldn't printed.
Comments
Post a Comment