If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jan 2009
    Member #
    I've helping a friend populate a template he bought. I've done pretty well so far, but I'm having a bugger of a time getting the contact form to work properly. So far I have it half working. I get an email at the specified address, but it does not include a name, address or phone number. The message field does show up in the body of the email though. Where have I gone wrong?


    Here's the html
      <div class="line"></div>
                                                    <form id="form" action="" enctype="multipart/form-data" name="form">
                                                        <table class="form">
                                                                <td width="170">
                                                                    Your name:
                                                                    <div class="h_f"><input type="text"></div>
                                                                    E-mail address:
                                                                    <div class="h_f"><input type="text"></div>
                                                                    <div class="h_f"><input type="text"></div>                                                            </td>
                                                                    Your message:
                                                                    <textarea cols="2" rows="2"></textarea><br>
                                                                    <a href="#"  onclick="document.getElementById('form').reset()" style="margin:0 11px 0 70px;">Clear</a><a href="#" onClick="document.getElementById('form').submit()">Submit</a>                                                            </td>
    and here's the php that goes with it
    $subject="from ".$_GET['Name'];
    $headers= "From: ".$_GET['Email']."\n";
     $headers.='Content-type: text/html; charset=iso-8859-1';
    mail("*****", $subject,  "
     <title>Contact letter</title>
    </html>" , $headers);
    echo ("Your message was successfully sent!");
        resizeTo(300, 300)


  3. #2
    Senior Member
    Join Date
    May 2003
    Member #
    Hi. Below are some pointers based on the code you provided.

    1. Your form does not have an action attribute (currently it reads action="")
    2. Your form has no method set. get is the fallback but you should specify which method (get or post)
    3. You have enctype="multipart/form-data but based on your code it does not look like you are offering an upload feature.
    4. I am not sure how the message works and the others do not because they are all missing a name attribute.

    You have code like
    PHP Code:
    $subject="from ".$_GET['Name']; 
    however no field in your form has a name of Name (perhaps call it fullname instead to make the code easier to follow). You will need to add similar for email and phone (such as name="emailAddress" and name="phoneNumber" respectively).

    5. You have a link which clears the form however forms already have a way of doing this - see below
    HTML Code:
    <input type="reset" name="reset" value="Clear" />
    Same goes for submit...
    HTML Code:
    <input type="submit" name="submit" value="E-mail me" />
    I think the biggest problem you have is not naming the form fields.

    Good luck.

  4. #3
    Junior Member
    Join Date
    Jan 2009
    Member #
    It worked! Thanks for the help the form now works.

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 07:30 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: