title: mysql : how to submit 2 sets of checkbox in two different column in a table
body: <p>I have two sets of div with different checkbox options :</p>
  
  <pre><code>&lt;div id="mobile_device" style="display:none;"&gt;
  &lt;font size="3"&gt;&lt;b&gt;Select the accessories :&lt;/b&gt;&lt;/font&gt;
  &lt;/br&gt;&lt;/br&gt;
      &lt;input type="checkbox" name="mobile[]" value="charger"/&gt;  Charger &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;input type="checkbox" name="mobile[]" value="case"/&gt; Case &amp;nbsp;&amp;nbsp;&amp;nbsp;
      &lt;input type="checkbox" name="mobile[]" value="headset"/&gt; Headset &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;input type="checkbox" name="mobile[]" value="box"/&gt; Box&amp;nbsp;&amp;nbsp; &amp;nbsp; 
      &lt;input type="checkbox" name="mobile[]" value="usb"/&gt; USB Cable &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;input type="checkbox" name="mobile[]" value="sim"/&gt; SIM&lt;br/&gt;
  &lt;/div&gt;
  
  div id="desktop_device" style="display:none;"&gt;
  &lt;font size="3"&gt;&lt;b&gt;Select the accessories :&lt;/b&gt;&lt;/font&gt;
  &lt;/br&gt;&lt;/br&gt;
  &lt;input type="checkbox" name="desktop[]" value="adaptor"/&gt;  Adaptor &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;input type="checkbox" name="desktop[]" value="privacy"/&gt; Privacy Screen &amp;nbsp;&amp;nbsp;&amp;nbsp;
  &lt;input type="checkbox" name="desktop[]" value="mouse"/&gt; Mouse &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;input type="checkbox" name="desktop[]" value="keyboard"/&gt; Keyboard&amp;nbsp;&amp;nbsp; &amp;nbsp; 
  &lt;input type="checkbox" name="desktop[]" value="connector"/&gt; Desktop Connector &lt;br/&gt;&lt;br/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Now I was trying to submit the set of checkbox values in two columns in my db.</p>
  
  <pre><code>if (isset($_POST['submit']))
      { 
          // get form data, making sure it is valid
          $type = $_POST['type'];
          $name = $_POST['name'];
          $serial = $_POST['serial'];
          $imei = $_POST['imei'];
          $mobile = implode(",", $_POST['mobile']);
          $desktop = implode(",", $_POST['desktop']);
          $chargerno = $_POST['chargerno'];
          $connectorno = $_POST['connectorno'];
          $monitor = $_POST['monitor'];
          $monitorno = $_POST['monitorno'];       
  
  
  
              // save the data to the database
              $sql3= "INSERT INTO devices (type, name, serial, imei, mobile, desktop, chargerno, connectorno, monitor, monitorno) VALUES ('$type', '$name', '$serial', '$imei', '$mobile', $desktop, $chargerno, $connectorno, $monitor, $monitorno)";
              mysqli_query($mysqli,$sql3) or die(mysqli_error($mysqli));
              }   
  </code></pre>
  
  <p>But i was getting error like Unknown column 'adaptor' in 'field list'.</p>
  
  <p>How can i submit the selected checkbox values from both the div into two different columns.</p>