www.webdeveloper.com
Results 1 to 5 of 5

Thread: need help getting html contact form with multipart/form-data to work with php

Hybrid View

  1. #1
    Join Date
    Feb 2014
    Posts
    2

    need help getting html contact form with multipart/form-data to work with php

    Hello -

    I'm not a developer. I modified a template to build a site, and need help getting the contact form, which has multipart/form-data, to work with a php processing script.

    Here's the relevant script:
    <h3 class="p2">Contact Form</h3>
    <form id="contact-form" form name ="contact" method="post"
    enctype="multipart/form-data" action="sendform.php">
    <fieldset>
    <label><span class="text-form">Name:</span>
    <input name="p1" type="text"></label>
    <label><span class="text-form">Email:</span>
    <input name="p2" type="text"></label>
    <label><span class="text-form">Phone:</span>
    <input name="p3" type="text"></label>
    <div class="wrapper">
    <div class="text-form">Message:</div>
    <textarea></textarea>
    </div>
    <div class="buttons">
    <a class="button" type="send" value="Send">Send</a>
    </div>
    </fieldset>
    </form>

  2. #2
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    All the things in the "name" attribute are passed in the $_POST array.
    Now, looking at your code, yours may be done via AJAX, because as-is, your <textarea> will not be sent and that send button is an anchor, not a button.

    Assuming you posted that, and it is a normal post form, the server would get something like:
    Code:
    $_POST['p1'];
    $_POST['p2'];
    $_POST['p3'];

  3. #3
    Join Date
    Feb 2014
    Posts
    2

    Thanks, but still confused

    Quote Originally Posted by NoEffinWay View Post
    All the things in the "name" attribute are passed in the $_POST array.
    Now, looking at your code, yours may be done via AJAX, because as-is, your <textarea> will not be sent and that send button is an anchor, not a button.

    Assuming you posted that, and it is a normal post form, the server would get something like:
    Code:
    $_POST['p1'];
    $_POST['p2'];
    $_POST['p3'];

    NoEffinWay (Like the name) - thanks, makes sense from what I've seen of scripts, and is getting me in the right direction. Was of the same opinion that <textarea> wouldn't be sent, because it doesn't have a name value, like the other fields do. I thought of putting in a name value, but (again, not a coder) didn't get anything that didn't show up on the page.

    If AJAX, what then?

  4. #4
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    I would need to see the javascript files to help with that. If you want, send me a PM and I'll work with you on it. Or you can paste the JS here, either way.

  5. #5
    Join Date
    Jan 2014
    Location
    Boston, Massachusetts
    Posts
    64
    Don't know if it'll help but I used a workaround for passing data to and from a textarea box. Check out my post here.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles