save checkbox in mysql

0

I have a situation, I want to save a series of answers that I have as a selection option through a checkbox. I already have the code but it does not save the results.

this is my part of options:

<div class="checkbox">
                            <label><input type="checkbox" name="COMO[]" value="1">01 Instrucción de Trabajo</label>
                            </div>
                           <div class="checkbox">
                            <label><input type="checkbox" name="COMO[]" value="2">02 Ayuda Visual</label>
                             </div>
                                <div class="checkbox">
                                  <label><input type="checkbox" name="COMO[]" value="3">03 Formatos</label>
                               </div>
                             <div class="checkbox">
                                <label><input type="checkbox" name="COMO[]" value="4">04 Procedimientos</label>
                            </div>
                           <div class="checkbox">
                            <label><input type="checkbox" name="COMO[]" value="5">05 Alerta de Calidad</label>
                             </div>

and this is where I keep the results.

<?PHP
require_once 'conexion.php';
$_ID_COMO =  stripslashes ($_POST["ID_COMO"]);
$_COMO =  stripslashes ($_POST["COMO"]);

IF ($_ID_COMO) {
    for ($i=0;$i<count($_COMO);$i++)    
        {     
            $query = "INSERT INTO metodologias (id_proceso,id_indicador,actividad)
            VALUES ('$_ID_PROCESO', '$_ID_COMO', '$_COMO'); ";
            $result = $conn->query($query);
            if (!$result) die($conn->error);    
        }
}
    
asked by antonio sanchez 14.06.2018 в 18:35
source

0 answers