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 = "jvenablephoto@gmail.com"; //recipient //$recipient = "copiman@gmail.com"; //recipient //$recipient = "ravimrk_diya@yahoo.com"; //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> Quote Link to comment 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(). Quote Link to comment 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 =) Quote Link to comment 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 Quote Link to comment 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. 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.