Hello,
I have been using the same php script for my contact pages for almost all my sites, but it doesn’t seem to work on a site that I am doing that is hosted with Go Daddy…
Is this a common problem? If so can someone point me to a script that will work? I tried google but couldn’t find anything solid.
Thanks!
smftre
March 15, 2010, 2:43pm
2
Would be mighty hard helping without seeing the code that this “contact form” uses.
Sorry.
The problem is after the form submits, it is redirecting back to the home page instead of the thanks.php page.
Here is the code on the actual contact.php page
<form method="POST" action="gdform.php">
<div id="contactbox">
<div id="contactsp">
<p>First Name: </p>
<p>Last Name: </p>
<p>Company: </p>
<p>Address 1: </p>
<p>Address 2: </p>
<p>City: </p>
<p>State: </p>
<p>Zip: </p>
<p>Email: </p>
<p>Phone: </p>
<p>Comment:</p>
</div>
<div id="contactsp2">
<p><input type="text" name="FirstName"></p>
<p><input type="text" name="LastName"></p>
<p><input type="text" name="Company"></p>
<p><input type="text" name="Address1"></p>
<p><input type="text" name="Address2"></p>
<p><input type="text" name="City"></p>
<p><input type="text" name="State"></p>
<p><input type="text" name="Zip"></p>
<p><input type="text" name="EmailFrom"></p>
<p><input type="text" name="Phone"></p>
<p><textarea rows="4" name="Comment"></textarea></p>
<p><input type="submit" name="submit" value="Submit"></p>
</form>
</div>
</div>
And here is the gdform.php page
<?php
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "erik@***.com, drew@***.com";
$Subject = "Inquiry from ***.com";
$FirstName = Trim(stripslashes($_POST['FirstName']));
$LastName = Trim(stripslashes($_POST['LastName']));
$Company = Trim(stripslashes($_POST['Company']));
$Address1 = Trim(stripslashes($_POST['Address1']));
$Address2 = Trim(stripslashes($_POST['Address2']));
$City = Trim(stripslashes($_POST['City']));
$State = Trim(stripslashes($_POST['State']));
$Zip = Trim(stripslashes($_POST['Zip']));
$Phone = Trim(stripslashes($_POST['Phone']));
$Comment = Trim(stripslashes($_POST['Comment']));
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\\"refresh\\" content=\\"0;URL=error.php\\">";
exit;
}
$Body = "";
$Body .= "FirstName: ";
$Body .= $FirstName;
$Body .= "\
";
$Body .= "LastName: ";
$Body .= $LastName;
$Body .= "\
";
$Body .= "Company: ";
$Body .= $Company;
$Body .= "\
";
$Body .= "Address1: ";
$Body .= $Address1;
$Body .= "\
";
$Body .= "Address2: ";
$Body .= $Address2;
$Body .= "\
";
$Body .= "City: ";
$Body .= $City;
$Body .= "\
";
$Body .= "State: ";
$Body .= $State;
$Body .= "\
";
$Body .= "Zip: ";
$Body .= $Zip;
$Body .= "\
";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\
";
$Body .= "Comment: ";
$Body .= $Comment;
$Body .= "\
";
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
if ($success){
print "<meta http-equiv=\\"refresh\\" content=\\"0;URL=thanks.php\\">";
}
else{
print "<meta http-equiv=\\"refresh\\" content=\\"0;URL=error.php\\">";
}
?>
Is anyone able to help with this? Or have had a similar problem with a GoDaddy site?
Thanks!
smftre
March 16, 2010, 2:19pm
5
Have you tried putting in the full domain path instead of just the uri?
[COLOR=#000000]print [COLOR=#dd0000]"<meta http-equiv=\“refresh\” content=\"0;URL=http://www.domain.com/thanks.php\\“>”[/COLOR][COLOR=#007700];[/COLOR][/COLOR]
I’ve had a lot of issues with GoDaddy and PHP, so I know your pain. I have heard the mail() function just doesn’t work sometimes.
You could try using GoDaddy’s form mailers if they suit your needs: http://help.godaddy.com/article/510
Or you can use PHPMailer instead of the mail() function: http://sourceforge.net/projects/phpmailer/