
<?php

include_once('conection.php');





$cedula = $_SESSION['cedula'];

$jornada = $_SESSION['jornada'];


//print_r($jornada);







if($cedula>0){

         ini_set('date.timezone','America/Bogota'); 
         $fecha_quiz = date('Y-m-d');
         $fecha_resp = date('Y-m-d H:i:s');

         

        
            //$si =  $_POST['si'];
         

         
           $cont = count($_POST);
         
        
         


        //print_r($_POST);

        for ($i=1; $i <= $cont ; $i++) { 

            $cons =$_POST["p$i"];

            $sql = $connection->prepare("select cons_preg from posibilidades where cons = $cons");
            $sql->execute();
            $cons_p = $sql->fetch(PDO::FETCH_ASSOC); 
           
            $cons_preg = $cons_p["cons_preg"];

            $insert = $connection->prepare("INSERT INTO det_pre_fun (cons_enc, cons_pre,    cedula_fun,  fecha_quiz,    resp,    fecha_resp,    jornada) 
                                                                VALUES (1,     '$cons_preg', '$cedula', '$fecha_quiz', '$cons', '$fecha_resp', '$jornada')");
            $insert->execute();    
            
        }

        
            echo 1;
        
        

}else{

    echo 2;
}


?>

