Skip navigation
robyn jean
Currently Being Moderated

Contact Form with Email PHP not working?

Mar 5, 2013 5:39 PM

Tags: #dreamweaver #email_form #contact_form

Hello !

 

Here is a link to my contact form:

http://bayareafacepainters.com/quote_face_painting.html

 

Here is the tutorial I am following to set up the Form to Email PHP

http://www.freecontactform.com/email_form.php

 

My form is not working. It is not sending me the email, and the "Thank you for contacting us page" is not showing up either. Is this a simple fix? I am not an expert coder, any help on what I am doing wrong or missing would be helpfull!

 

 
Replies
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Mar 5, 2013 8:07 PM   in reply to robyn jean

    Robyn, We need to see your PHP code - which is something you need to copy and paste here. We cannot view PHP codes via the web URL you've posted as it is a server-side code and will not be shown on browsers.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2013 11:12 PM   in reply to robyn jean

    When a form is submitted, the values of the inputs are stored in the name attribute and retrieved as follows

    $first_name = $_POST['first_name'];

    Here the value of the input with a name of first_name is given to the PHP first_name variable.

     

    There is also a hard and fast rule that the name attribute can only contain alphanumeric characters; but NO spaces

     

    Now have a look at

      <tr>

        <td class="form_table_tr_td"><p>Email:</p></td>

        <td> </td>

        <td><input name="" type="text" maxlength="35" /></td>

        <td> </td>

      </tr>

    No value will be passed on to your PHP script. Just name the name attribute.

     

    Also have a look at

      <tr>

        <td class="form_table_tr_td"><p>Phone (with area code):</p></td>

        <td> </td>

        <td><input name="Phone Number" type="text" maxlength="10" /></td>

        <td> </td>

      </tr>

    Your PHP script will not allow this. Add a dash as per "Phone_Number" or give it a name of "Phone"

     

    I have not gone through the rest of your markup, suffice to say, I'll leave that up to you.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 3:21 PM   in reply to robyn jean

    You missed this one

     

      <tr>

        <td class="form_table_tr_td"><p>How would you prefer we contact you?</p></td>

        <td> </td>

        <td><p>

          <label>

            <input type="checkbox" name="Contact Preference" value="checkbox" id="ContactPreference_0" />

            Email</label>

          <br />

          <label>

            <input type="checkbox" name="Contact Preference" value="checkbox" id="ContactPreference_1" />

            Phone</label>

          <br />

        </p></td>

        <td> </td>

      </tr>

    As far as the PHP page is concerned, have a look at

    if(!isset($_POST['first_name']) ||

            !isset($_POST['last_name']) ||

            !isset($_POST['email']) ||

            !isset($_POST['telephone']) ||

            !isset($_POST['comments'])) {

    Where in your html-form will you find the above values? Your form has an input for Name, Email and Phone, just to name a few. The values are also case sensitive.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 4:30 PM   in reply to robyn jean

    >if(isset($_POST['email'])) {

     

    Your form does not have a field named 'email'.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 5:04 PM   in reply to robyn jean

    What are these variables used as arguments int he .clean_string function? These variables are not populated anywhere in your script

     

    $email_message .= "First Name: ".clean_string($first_name)."\n";

    $email_message .= "Last Name: ".clean_string($last_name)."\n";

    $email_message .= "Email: ".clean_string($email_from)."\n";

    $email_message .= "Telephone: ".clean_string($telephone)."\n";

    $email_message .= "Comments: ".clean_string($comments)."\n";

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points