php contact form with reply message
<p>I created a contact form that uses my php script to email the form parameters:</p>

<pre><code>//File email.php
&lt;?php
include('variables.php');
$to = "info@timeshare.org.uk";
$subject = "Quote From Website";

$name = $_POST["name"];
$email = $_POST["email"];
$number = $_POST["number"];
$resort = $_POST["resort"];
$headers = "From: ".$to."\r\n";

$message = "Name: ".$name."\r\n".
    "Email: ".$email."\r\n". 
    "Number: ".$number."\r\n".
    "Resort Name:".$resort."\r\n";

if (mail($to,$subject,$message,$headers)){
    $replyHeader = "Thank You!";
    $replyMessage = "Thank you for using our quick contact form. We will get back to you as soon as possible.";
}else{
    $replyHeader = "Oops!";
    $replyMessage = "An Error Occured whilst trying to send the form. Please try again later";
}
header( 'Location: http://localhost/TimeShare/formReturn.php' ) ;
?&gt;
</code></pre>

<p>on submit the form action points to this code.</p>

<p>Now if the mail function is successfull, i want the form to redirect to formReturn.php, however i want the content in a particular div to show the $replyHeader and $replyMessage.</p>

<p>So once the form is posted, it redirects to a page that either displays a successfull message or an error message.</p>

<p>Now on my formReturn.php page ive tried including the variables Like so:</p>

<pre><code>//File: formReturn.php
&lt;body&gt;
    //Header code...
    //sidebar code...
    &lt;div&gt;
        &lt;?php include('php/email.php'); ?&gt;
        &lt;h1&gt; &lt;?php echo $replyHeader; ?&gt; &lt;/h1&gt;
        &lt;p&gt; &lt;?php echo $replyMessage ?&gt; &lt;/p&gt;
    &lt;/div&gt;
    //Footer code...
&lt;/body&gt;
</code></pre>

<p>Problem with this code is, because im including the email.php file, i end up with a redirection loop. Which is bad!</p>

<p>So how would i get the variables $replyHeader and $replyMessage onto the page in that specific location depending on the success or failure of the mail() function</p>
