<form method="POST" action="contact.php">
<p>
Your Name:
<input type="text" name="name" style="width: 177px" /></p>
<p>
Email Address:
<input type="text" name="email" style="width: 160px" /></p>
<textarea name="message" rows="12" cols="30">Message</textarea><br />
<input type="submit" name="send" value="Submit" />
</form>
and my php looks like this:
<?php
$to = "me@example.com";
$subject = "Contact Us";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
$loc = thankyou.htm
if($sent)
header("Location: $loc");
exit();
else
{print "We encountered an error sending your mail"; }
?>
When clicking submit it just goes directly to contact.php and does not redirect back to the contact page. I have made $loc a variable, but have tried using the http:// path directly in the header as well. I even tried to incorporate javascript, but nothing seems to work. However when i just insert a print command instead of the header command it does work.
Can someone please give me some advice? I have googled this problem over and over and nothing seems to make sense or work.
This post has been edited by Dormilich: 23 February 2012 - 02:03 AM
Reason for edit:: protecting your inbox from spam

New Topic/Question
Reply



MultiQuote




|