-
PHP contact form problem
Hi,
I wanted to ask if someone could help troubleshoot a contact page. The problem is as follows, when someone completes the contact form and clicks the submit button, a 404 error page comes up saying the page may have been moved, etc.
The contact page and the process_form.php are both in the root directory. I have tried to figure out what is wrong but thus far, I'm not able to do so.
A link to the contact page follows. Any help would be much appreciated. Thanks.
http://theschoolmaster.org/contact.html
-
there might be some PHP coding problem in you're process_form.php, check it carefully
-
Thank you for your response. I should have included the PHP coding. The coding follows. To me the coding looks okay; however, I don't understand php enough to know if there is a problem.
<?php
/* INSTRUCTIONS
**************
* 1) Change the 'emailTo' variable (below) from "you@yourdomain.com (Your Name)" to your own email and your own name
* 2) Change the 'emailFrom' variable (below) from "yourdomain.com" to your own domain (no www required)
* 3) a) Change the 'redirect' variable (below) from "www.yourdomain.com" to your own domain.
* b) Make sure you have a "thank_you.htm" in the root folder of your website
* 4) Make sure that each of your for elements on the page that submits to this script are named
* like the following: <input type=text name="INFO__User_Name">
* NOTE: You cannot have spaces in the name of the for element.
* ie: GOOD element name "INFO__User_Name"
* BAD element name "INFO__User Name"
* 5) Set the "action" of the form to "process_form.php" in the form page that submits to this script
* Example: <form method='post' action='process_form.php'>
* 6) Submit form to make sure all required information gets emailed to you. If not, then go through steps 4 and 5 again.
*/
// CONFIGURATION SETTINGS
$emailTo = "webmaster@theschoolmaster.org (The Schoolmaster)";
$emailFrom = "noreply@theschoolmaster.org (The Schoolmaster Form Results)";
$subject = "Web Form Results";
$redirectURL = "http://www.theschoolmaster.org/thank_you.html";
// PLACE ALL FIELDS PASSED IN FROM FORM INTO MESSAGE BODY
foreach ($_POST as $key => $value) {
$keyInfo = explode("__", $key);
if ($keyInfo[0] == "INFO") {
$message .= $keyInfo[1].":\n ".$value."\n\n";
}
}
// SEND EMAIL
mail($emailTo, $subject, $message, "From: ".$emailFrom);
// REDIRECT TO SPECIFIED THANK YOU PAGE
header("Location: $redirectURL");
?>
-
It runs fine in my own envorment. Have you used the mail() function in php before? Who is your host? They might not support the mail() function.
-
Yes, I have used it before. The hosting company I use is Hostway. I will follow-up with Hostway and ask about the mail ().
Thank you for your response.
-
Thanks for the suggestion to follow-up with the hosting company. I called, they did a quick reinstall of php and the contact form is working fine now.
I really appeciate the suggestion and help.
-