Multiple choice answers go into wrong array when posting to mysql

  • Profile Image
    lasercorp
    Asked 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.

  • Profile Image
    Nik_C
    Answered 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
    lasercorp
    Answered 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
    jonathan
    Answered 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
    lasercorp
    Answered on June 21, 2017 at 09:38 PM

    Hi, Any update on this fix?

  • Profile Image
    Chriistian
    Answered 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
    NeilVicente
    Answered 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.