title: How do I insert multiple checkbox values into database?
body: <p>How do I insert multiple checkbox values into database? Here is my code, it workes for the radio buttons where there is only one value, but how do I insert more if I have checkboxes?</p>
  
  <p>PHP CODE:</p>
  
  <pre><code>if(isset($_POST['radio']) &amp;&amp;
      isset($_POST['checkbox'])){
  
      $radio = $_POST['radio'];
      $checkbox= $_POST['checkbox'];
  
      $sql = "INSERT INTO info(radio, checkbox)VALUES ('$radio', '$checkbox')";
      $result = mysql_query($sql);
  
  }
  </code></pre>
  
  <p>HTML CODE:</p>
  
  <pre><code>&lt;input type="radio" name="radio" value="1"&gt;1&lt;br&gt;
  &lt;input type="radio" name="radio" value="2"&gt;2&lt;br&gt;
  
  &lt;input type="checkbox" name="checkbox" value="1"&gt;1&lt;br&gt;
  &lt;input type="checkbox" name="checkbox" value="2"&gt;2&lt;br&gt;
  &lt;input type="checkbox" name="checkbox" value="3"&gt;3&lt;br&gt;
  &lt;input type="checkbox" name="checkbox" value="4"&gt;4&lt;br&gt;
  &lt;input type="checkbox" name="checkbox" value="5"&gt;5&lt;br&gt;
  &lt;input type="checkbox" name="checkbox" value="6"&gt;6&lt;br&gt;
  </code></pre>