dimanche 21 avril 2019

checkboxes without form tags , no checked checkboxes found

so i've been working on this problm for like 2 days , i've tried all the solutions i found here
my problm is that i'm using checkboxes without form tag and i want to get the checked boxes into an array and return that array so i can insert the answers afterwards into a database but all i get is empty array even though i check


function recherche_salle ($conn,$datte,$begin,$end) 
{ 

$salle_libre= array(); 
$position=0; 
$str='';
$sql= "select  * from time_report_ where  new_date = '".$datte."' and  ('".$begin."' BETWEEN debut AND fin or '".$end."' BETWEEN debut AND fin)
UNION 
select  * from  events where  new_date = '".$datte."' and  ('".$begin."' BETWEEN debut AND fin or '".$end."' BETWEEN debut AND fin);"; 
$results = mysqli_query($conn,$sql); 
$resultscheck = mysqli_num_rows ($results); 

if ($resultscheck>0)  
{  
    while ($row= mysqli_fetch_assoc($results)) 
  { 
    array_splice( $salle_libre, $position, 0,$row['Salle']); 

    $position= $position+1;

  } 
} 

  $image= implode("','", $salle_libre);
   //echo $image; 
   $sqll= "SELECT DISTINCT Salle FROM liste_des_salles WHERE Salle NOT in ('$image') limit 1;";
   $resultss = mysqli_query($conn,$sqll); 
   $resultscheckk = mysqli_num_rows ($resultss); 
   if ($resultscheckk>0)  
 {  echo ("voici la liste des salles libres" ."<br>");
    while ($roww= mysqli_fetch_assoc($resultss)) 
   {   
       $str ='<br/>'.$roww['Salle'].'<input type="checkbox" value='.$roww['Salle'].' name="check[]" >'; 


    }



     echo $str; 
     if(isset($_post['check[]'])) 
      {$rooms=$_post['check[]'];}










 }

    return $rooms;    

}




Aucun commentaire:

Enregistrer un commentaire