Results 1 to 7 of 7

Thread: PHP contact form problem

  1. #1
    Join Date
    Jan 2008
    Posts
    17
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default 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

  2. #2
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    there might be some PHP coding problem in you're process_form.php, check it carefully

  3. #3
    Join Date
    Jan 2008
    Posts
    17
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    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");

    ?>

  4. #4
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    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.
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  5. The Following User Says Thank You to fileserverdirect For This Useful Post:

    renset (05-24-2008)

  6. #5
    Join Date
    Jan 2008
    Posts
    17
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    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.

  7. #6
    Join Date
    Jan 2008
    Posts
    17
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    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.

  8. #7
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    .....

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •