ultratek Posted October 13, 2008 Share Posted October 13, 2008 i cannot figure out why my handle_form will not redirect back to the home page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Form Feedback</title> </head> <body> <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $subject = $_POST['subject']; $comments = $_POST['comments']; $name = $name; //senders name $email = $email; //senders e-mail adress $recipient = "[email protected]"; //recipient //$recipient = "[email protected]"; //recipient //$recipient = "[email protected]"; //recipient $comments = "$comments...\n\n".$phone; $subject = $subject; //subject $header = "From: ". $name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $comments, $header); //mail command echo "Mail has been sent successfully. You are being redirected home."; header('Refresh: 3; url=index.php'); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/128287-solved-redirecting/ Share on other sites More sharing options...
DarkWater Posted October 13, 2008 Share Posted October 13, 2008 Add: <?php ini_set('display_errors', 1); error_reporting(E_ALL); ?> To the top of your script and it should become apparent. You are not allowed to have ANY output before a call to header(). Link to comment https://forums.phpfreaks.com/topic/128287-solved-redirecting/#findComment-664505 Share on other sites More sharing options...
ultratek Posted October 13, 2008 Author Share Posted October 13, 2008 no errors displayed... on my dads site i print an echo before the header refresh and it works... thank you for responding =) Link to comment https://forums.phpfreaks.com/topic/128287-solved-redirecting/#findComment-664512 Share on other sites More sharing options...
sylvertwst Posted October 13, 2008 Share Posted October 13, 2008 yeah from the html tags to that echo just before the redirect.. cant have it. in your situation i would recommend javascript redirect instead. there's tons of tuts on that on google Link to comment https://forums.phpfreaks.com/topic/128287-solved-redirecting/#findComment-664514 Share on other sites More sharing options...
DarkWater Posted October 13, 2008 Share Posted October 13, 2008 no errors displayed... on my dads site i print an echo before the header refresh and it works... thank you for responding =) Funny, because I just ran your script and it gave me a header() error. Link to comment https://forums.phpfreaks.com/topic/128287-solved-redirecting/#findComment-664515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.