Tonight I have been trying to tidy up my contact form a bit, but having got the form sorted, my PHP seems to have gone wrong somewhere along the way. The actual script is unchanged, but it seems to have developed an annoying problem whenever the page is refreshed. A warning message pops up containing:
"The page you trying to view contains POSTDATA. If you resend the data..."
I cant pretend to know much about the PHP, but I can just about follow how this script works (ish).
If anyone can spot anything thats wrong, I would be extremely grateful if you could point it out. I havent a clue where to start looking. If it helps in any way, I can upload the relevant files.
Any help would be much appreciated
"The page you trying to view contains POSTDATA. If you resend the data..."
I cant pretend to know much about the PHP, but I can just about follow how this script works (ish).
PHP:
<?php
// Configuration Start \\
$YourEmail = "[email protected]";
$YourSubjects = array("General Enquiry","Hire","Site Comment","Other");
// Configuration End \\
if($Submit)
{
if(empty($email) || empty($name) || empty($message))
{
echo "<p class=alert>** You forgot to enter some of the required fields. Please go back and make sure you entered all the fields correctly. **</p>";
}
elseif(!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3})?)$', $email))
{
echo "<p class=alert>** The e-mail is not valid. Please go back and try again. **</p>";
}
else
{
$Message = "$name has contacted you with Subject: $Subject. The message is below.\n\n***************\n$message\n***************\n\nIP of sender: $_SERVER[REMOTE_ADDR]\nE-mail of sender: $email";
$headers = 'From: ' . $email . "\r\n" .
'Reply-To: ' . $email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($YourEmail, $Subject, stripslashes($Message), $headers);
echo "Your E-Mail has been successfully sent. Thankyou for taking the time to contact us, we will try and reply as soon as possible.";
}
}
else
{
echo '
<form name="cf" method="post" action="">
<label for="name">Your Name:</label>
<input type="text" id="name" name="name" value="" /><br />
<label for="email">Email Address:</label>
<input type="text" id="email" name="email" value="" /><br />
<label for="locn">Subject:</label>
<select class="subject" name="Subject">
';
foreach($YourSubjects as $Subject)
{
echo '<option>' . $Subject . '</option>';
}
echo '
</select>
<label for="message">Message:</label>
<textarea name="message"></textarea>
<input type="submit" name="Submit" class="submit" value="Send" /><input class="reset" type="reset" name="Reset" value="Reset" /><br />
</form>
';}?>
Any help would be much appreciated
