What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Multiple choice answers go into wrong array when posting to mysql

    Asked by lasercorp on June 03, 2017 at 11:18 AM

    Hi,

    I am posting a multiple choice question that is a required field to a mysql db.

     

    The issue is that if the user chooses option 1 & 3, the answer for option 3 gets inserted into array [1] instead of [2]

    as follows ;

    $campsession1 = $_POST['campsessions']['0'];

    $campsession2 = $_POST['campsessions']['1'];

    $campsession3 = $_POST['campsessions']['2'];

     

    but is they select all three options or just the first option , the data gets posted correctly.

    Page URL:
    https://form.jotformpro.com/lasercorp/clone-of-cam-registration-form

  • Profile Image
    JotForm Support

    Answered by Nik_C on June 03, 2017 at 02:53 PM

    I tested the form and I saw what you're referring to and I assume that this issue is related to indexes of the checkbox fields.

    Since whatever is chosen as second, will be with the second index, I found this thread from one of my colleagues, where this issue was discussed and resolved: 

    https://www.jotform.com/answers/436393

    If you still have this issue please let us know.

    Thank you!

  • Profile Image

    Answered by lasercorp on June 04, 2017 at 12:28 PM

    Hi,

    the posted solution does not address the issue but only suggests  concatenating the three answers into one field with a comma separator. 

    A multiple choice answer should be able to be entered into the appropriate array field 

     

    It seems like a bug in the code. Can this be escalated and resolved? 

     

    Thanks, 

    eric 

  • Profile Image
    JotForm Support

    Answered by jonathan on June 04, 2017 at 02:52 PM

    I was able to reproduced the glitch as well. The posted data have a wrong index number in the array when using fields that allows multiple choices.

    Example: 

    It can be tested using the test post data URL  https://www.jotform.com/show-post-data/

    The glitch can result to wrong data collection.

    I have elevated this thread now to the higher team support so that they can check and apply the needed fix.

    We will notify you here once we have new updates on the status.

    Thank you.

     

  • Profile Image

    Answered by lasercorp on June 21, 2017 at 09:38 PM

    Hi, Any update on this fix?

  • Profile Image
    JotForm Support

    Answered by Chriistian on June 21, 2017 at 11:21 PM

    There is no update yet regarding this issue. Rest assured you will be informed in this thread if there are any updates on this fix.

    Regards.

  • Profile Image
    JotForm Support

    Answered by NeilVicente on June 22, 2017 at 05:08 PM

    Hi there,

    Post data for check box fields works as designed. We consider unselected check box fields as empty, so we only collect those that are checked.

    Can you tell us how exactly you intend to use these values on your script?

    We would love to help with a workaround, if possible.