PDA

View Full Version : Contact Form submission error on PC, not with MAC


sydesign
02-03-2011, 09:21 PM
I have designed a contact form for a website and set it to go to a success page after it is submitted and then to send the user back to the website automatically after 3 seconds.

Due to problems with spam i had to add an if statement so that no one could visit my php script without submitting the form. if someone does then the page will say "you cannot see this page without sending the form"

Now on my MAC everything works fine like it is supposed to but when tried on a PC it does not return the user back to the website, rather it sends the user to the php page therefore showing the message "you cannot see this page without sending the form."

Does anyone have an idea on why this might be happening?

here is my php script:

<?php
if (array_key_exists('submit', $_POST)) {

/* Email Variables */
$emailSubject = 'xxxxxxxxx'; /*Make sure this matches the name of your file*/
$webMaster = 'info@xxxxxxxx.com';



/* Data Variables */

$email = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$company = $_POST['company'];
$comments = $_POST['message'];



$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Phone: $phone <br>
Company: $company <br>
Comments: $comments <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);


/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="3;http://www.xxxxxxx.com/">
<style type="text/css">
<!--
body {
background-color: #fff; /* You can edit this CSS to match your website*/
font-family: "Times New Roman";
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #600;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">Thank you! Your email will be answered as soon as possible! You will return to xxxx in a few seconds.</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
} else {
echo "You can't see this page without submitting the form.";
}
?>

edbr
02-04-2011, 01:21 AM
try the meta refresh before the title im not sure that this is the answer but that is how it is advised to be used

sydesign
02-04-2011, 08:03 PM
It didn't seem to fix it. Thank you for the help though!

i decided to bring it to a success page that has the sites tabs on it rather than refreshing once again to the site.

edbr
02-05-2011, 01:11 AM
no prob, it can be done with javascript of course

diego715
02-09-2011, 05:27 AM
Try this <meta http-equiv="refresh" content="3; URL=http://xxxxxxxxx.com"> hope this help