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 protected]"; $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"); } ?> Link to comment https://forums.phpfreaks.com/topic/60135-redirect-page/ 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"; Link to comment https://forums.phpfreaks.com/topic/60135-redirect-page/#findComment-299159 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 Link to comment https://forums.phpfreaks.com/topic/60135-redirect-page/#findComment-299164 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>"); Link to comment https://forums.phpfreaks.com/topic/60135-redirect-page/#findComment-299166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.