0

i have my php file and i cant make it go to index.html after the user clicks the ok button once they get confirmation of their email sent.

<?php
$name = $_REQUEST['Name'];
$email = $_REQUEST['Email'];
$message = $_REQUEST['Message'];

$email_message = "
Name: ".$name."
Email: ".$email."
Message: ".$message."
";

mail ("info@email.com", "New inquiry", $email_message);

print '<script type="text/javascript">';
print 'alert("Your email has been sent! Someone will get in touch with you shortly. Thank You.")'; 
print '</script>'; 

header('Location: index.html'); 

?>
Henry
  • 1
  • 1
  • 1
    Header only works if you don't display anything. If you use print or echo, header doesn't work. – Jose Manuel Abarca Rodríguez Jun 25 '15 at 22:48
  • like Jose said, it'd be better if you removed the prints and changed your header line to `header('Location: index.html?confirm=email')` then in your index.html you have javascript take over and pull that confirm part of the email and display the alert – iam-decoder Jun 25 '15 at 22:53

0 Answers0