Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Submit a long form with ajax..

    Hi,

    I'm looking for a way to submit a forum with a dynamic number of fields with ajax.

    My form has the following fields and the user can create more with javascript:

    <input type="text" name="i_1">
    <input type="text" name="i_2">
    <input type="text" name="i_3">
    <input type="text" name="i_4">

    Now, I want to send this form's information to store.php file to put all the information in a database with ajax.

    Can anyone help me find a way to do this?
    Thanks

  • #2
    Regular Coder
    Join Date
    Jan 2008
    Location
    Geneva, Switzerland
    Posts
    413
    Thanks
    12
    Thanked 29 Times in 29 Posts
    Well, you need:

    1. Find all inputs that you want in your HTML and get their contents.
    2. Put everything in an array
    3. Use AJAX to pass that array to your PHP page
    4. Use a foreach in PHP to insert each value in your db

    If you want further help:

    1. Do you use a library?
    2. What do you know how to do, and what do you don't, ie what do you need examples for to continue.
    Chuck Norris counted to infinity.
    Twice.


  •  

    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
    •