2

I have a form with the following fields. For some strange reason phone and message are not being sent in the post request.

<form id="contact-form" method="post" action="contact.php" name="contactform">
    <fieldset>
        <div class="float-left">
            <label for="Name">Full Name</label>
            <input id="name" type="text" name="name" />
            <label for="Email">Email Address</label>
            <input id="email" type="text" name="email" />
            <label for="Phone">Phone Number</label>
            <input name="phone" type="text" id="phone" />
        </div>
        <div class="float-right">
            <label for=comments accesskey=C>Message</label>
            <textarea id="comments" rows="10" cols="10" 
                name="comments"></textarea>
            <button id="submit" type="submit">Send Enquiry</button>
        </div>
        <div class="clear"></div>
    </fieldset> 
</form>

Post:

Parametersapplication/x-www-form-urlencoded
comments    
email   [email protected]
name    Joe Bloggs
phone   
Source
name=Joe Bloggs&email=ukkgfpower%40hotmail.com&phone=&comments=
8
  • phone and comments are there. There are just empty: &phone=&comments=. What happens when you populate the fields and post your form? Nov 1, 2011 at 18:18
  • I see that phone is being sent just fine, there's no value but it is being sent. You don't have any form element with a name of message, did you mean comments? If so, i see that too. Nov 1, 2011 at 18:18
  • yes sorry I meant comment and phone are not being sent, yet they are filled out in the form. Could something else affect them Nov 1, 2011 at 18:21
  • @KeithPower Are you checking for these in the script you're submitting to "contact.php"? And are the other fields being passed correctly? As the others have said, I tested the code you have and it works fine. Nov 1, 2011 at 18:29
  • 1
    Is it possible that you have some kind of javascript running that might be stripping them out? This was my problem. I had a script for making placeHolder work in IE, and it was removing form items.
    – Jake
    Dec 28, 2011 at 21:56

1 Answer 1

1

the problem was the field names were not set correctly in the js file that handles the ajax submitting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.