khujo56 Posted July 16, 2007 Share Posted July 16, 2007 Hi Guys Need help trying to figure out why it will not redirect to the assigned page. it says that info has been sent to assigned e-mail after the submit button has been pressed, but does not redirect to the page. below is the code. <?php if(isset($_POST['name']) && empty($_POST['name'])) { $error[] = "Post your name"; } if(isset($_POST['email']) && empty($_POST['email'])) { $error[] = "Post your name"; } if(isset($_POST['message']) && empty($_POST['message'])) { $error[] = "Post your name"; } if(is_array($error)) { echo("errors:<br>"); foreach($error as $x => $i) { echo("- ".$i."<br>"); } } else { $to = "email@here.com"; $subject = "subject"; $message = $_POST['message']; $name = $_POST['name']; $from = $_POST['email']; mail($to, $subject, $message, "From: $name<$from>"); echo("<script>alert(\"Thanks!\nE-mail has been sent!\");</script>"); $url = "www.iheartvacation.com."; header("Location: $url"); } ?> Quote Link to comment Share on other sites More sharing options...
trq Posted July 16, 2007 Share Posted July 16, 2007 $url = "www.iheartvacation.com."; Should be... $url = "http://www.iheartvacation.com"; Quote Link to comment Share on other sites More sharing options...
khujo56 Posted July 16, 2007 Author Share Posted July 16, 2007 i fixed there error but now i get this error when i click submit Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/n/r/jnr1975/html/mailer.php:31) in /home/content/j/n/r/jnr1975/html/mailer.php on line 34 Quote Link to comment Share on other sites More sharing options...
trq Posted July 16, 2007 Share Posted July 16, 2007 Remove... echo("<script>alert(\"Thanks!\nE-mail has been sent!\");</script>"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.