Inserting checkbox answers into a database column

  • eridamega
    Asked on June 18, 2017 at 4:02 PM

    Please help me with this code, yo insert array https://www.jotform.com/answers/1176672-How-do-I-insert-multiple-checkbox-values-into-a-table

  • Mike
    Replied on June 18, 2017 at 4:42 PM

    You may try an implode() function to join array elements into a string. Please check answer from Charmiequino in the next thread.

    What is the appropriate way to handle checkboxes in mySQL?

    Thank you.

  • eridamega
    Replied on June 18, 2017 at 9:48 PM
    [seleccionael25] => Array 
    ( 
    [0] => Oximetros de pulso 
    [1] => Linterna (Penlights)
    [2] => Repuestos Littmann 
    [3] => Doppler fetal 
    [4] => Martillo de refeljos 
    [5] => Cubre-Fonendos 
    [6] => Tensiometros 
    [7] => Equipo de organos 
    [8] => Otros accesorios 
    [9] => Batas Greys Anatomy 
    )
    

    I used this code and it does not work

     

    $checkbox = array("seleccionael25" => $_POST[seleccionael25]); // Nuevo codigo de jotform

    $articulo  = implode(',', $checkbox['seleccionael25']);

    Obtained from here https://www.jotform.com/answers/436393

     

    What am I doing wrong?

     

  • Chriistian Jotform Support
    Replied on June 18, 2017 at 11:19 PM

    Since the checkbox is in array, you don't need to use the array() function. Please remove this code below:

    $checkbox = array("seleccionael25" => $_POST[seleccionael25]); // Nuevo codigo de jotform

    $articulo  = implode(',', $checkbox['seleccionael25']);

     

     

    Please try the following code instead:

    $articulo  = implode(',', $_POST[seleccionael25]);

     

    Regards.