Inserting checkbox answers into a database column

  • Profile Image
    eridamega
    Asked on June 18, 2017 at 04: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



    This is a re-post of a comment on How to Post Submission Data to Thank You Page

  • Profile Image
    Mike
    Answered on June 18, 2017 at 04: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.

  • Profile Image
    eridamega
    Answered on June 18, 2017 at 09: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?

     

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