crazy_clairey Posted November 30, 2009 Report Share Posted November 30, 2009 Hi there, I have created a contact form for a website. It will send the mail no problem in Firefox and Safari. However, it will not send in IE. The url should go to the contactthanks.html page but instead it goes to the www.mysite.com/mailer.php page. Can anyone help me? I can't seem to find an answer anywere online, but then I'm not sure what I'm doing wrong! My code is below. Thanks so much in advance for any help! Here is my PHP: [*]<?php if(isset($_POST['submit'])) { $from = 'My Site'; $to = "me@mysite.com"; $subject = "Contact Form"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; mail($to, $subject, $body); header( "Location: http://www.mysite.com/contactthanks.html\"); } else { echo "thankyou!"; } ?> Here is my HTML: [*] Name Email Address Message Thankyou! Quote Link to comment Share on other sites More sharing options...
cornetofreak Posted November 30, 2009 Report Share Posted November 30, 2009 Change header( "Location: http://www.mysite.com/contactthanks.html\"); to if(!headers_sent()){ header("Location: /contactthanks.html"); exit(); } Quote Link to comment Share on other sites More sharing options...
crazy_clairey Posted November 30, 2009 Author Report Share Posted November 30, 2009 Hi there, Thanks so much for your help! It's working now! I really appreciate it, I was pulling my hair out all day! Thanks again Quote Link to comment Share on other sites More sharing options...
Wickham Posted November 30, 2009 Report Share Posted November 30, 2009 As a matter of interest, would the header code work if it wasn't an absolute url; but a variable; in other words like:- header( "Location: $contactthanks"); where there is a variable $contactthanks = 'contactthanks.html' ; because that's what I do and my forms work in IE. 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.
Note: Your post will require moderator approval before it will be visible.