title: Getting values of HTML checkboxes in php
body: <p>I am creating an HTML form and I have a textbox in that. My requirement is that a user can check multiple check boxes, and then I have to get all checked values and then send the values to the database (I want to use PHP).</p>
  
  <p>Here is my code for within the textbox</p>
  
  <pre><code>     $Intensive=$_POST['Intensive'];
    $Intensive_count=count($Intensive);
    $i=0;
    //$count=0;
      //$index;
    $max=0;
    //$index;
     While($i &lt; $Intensive_count)
     {
      if($Intensive[$i]=="High frequency ventilation" )
     {
     $Intensive_score=4; 
    }
       elseif($Intensive[$i]=="Mechanical ventilation with muscle relaxation")
    {
     $Intensive_score=4;
    }
    elseif($Intensive[$i]=="Mechanical ventilation")
    {
     $Intensive_score=3;
    }
    elseif($Intensive[$i]=="CPAP")
    {
     $Intensive_score=2;
    }
    elseif($Intensive[$i]=="supplemental oxygen")
    {
     $Intensive_score=1;
    }
  
   if($Intensive_score&gt;$max)
    {
     $max=$Intensive_score;
     $index=$i;
   }
    $i++;
   }
  </code></pre>
  
  <p>Now with the above code I am able to echo the value ,but the record is not going to the database.</p>
  
  <pre><code>$sql1="insert into Form2 values('$Medical_Record_Id','$sub1','$Question1','4','$Intensive[$index]','$max')";
  
   mysql_query($sql1);
  </code></pre>
  
  <p>Could anybody tell me how to go about it.</p>
  
  <p>Thanks ..:)</p>