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

02-03-2011, 08: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:

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
Name: $name <br>
Email: $email <br>
Phone: $phone <br>
Company: $company <br>
Comments: $comments <br>

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

/* Results rendered as HTML */
$theResults = <<<EOD
<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;
<div align="center">Thank you! Your email will be answered as soon as possible! You will return to xxxx in a few seconds.</div>
echo "$theResults";
} else {
echo "You can't see this page without submitting the form.";

02-04-2011, 12: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

02-04-2011, 07: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.

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

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