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 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2012
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Post Process Form Multiple Times

    How does one go about processing a form multiple times before submitting the form's data to mysql. I only want the data submitted when the form finishes processing.
    What I have is a Javascript program that is displaying a set of images one by one and asking the same question after every 6 images using the same form. I know how to submit forms to mysql and create forms etc. What I do not know is how to store the answers from each form submission before submitting. I would presume an array is the way of going about this but don't have a clue and cant seem to punch in the correct key words in google for assistance.
    Here is my code for my form.
    PHP Code:
    include 'dbc.php'//My connection to my mysql database. 
    Code:
    <img id="theImage" alt="the image" />
    <img id="theTest" alt="the test" />
    <div id="theQuestion" align="center">
        <form id="theForm">
        Is this an exact match for one of the shapes you just saw?<br/>
        <label><input name="yesno" value="yes" type="radio" /> Yes</label>
        <label><input name="yesno" value="no" type="radio" /> No</label>
        </form>
    </div>

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,903
    Thanks
    15
    Thanked 226 Times in 226 Posts
    I'm sure someone has some more advanced answers, but what I've been doing with javascript is building an array with push, and setting the array as the value of an input. When you submit the form the data appears on the php side as a comma separated list which can be exploded. If you have multiple arrays to upload, just add another separator such as ^ . This works very well for numerical data and for 'clean' text, but be careful of user submitted text.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #3
    New Coder
    Join Date
    Feb 2012
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I think I understand, Do you perhaps have an example of this so I can learn how to do it?


  •  

    Posting Permissions

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