title: How can I save the data marked in the checkbox to the database?
body: <p>I wanted to save the checkboxes to the database with a ready code. But I am having a problem and I couldn't handle it even though I tried a lot of things.I leave it here to ,php and html codes for  you.This is the error:</p>
  <p>input
  PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/main.php:3<br />
  Stack trace:<br />
  #0 {main}<br />
  thrown in /home/main.php on line 3</p>
  <pre><code>&lt;?php
  $conn = mysqli('localhost', 'root', '','testdemo') or die(&quot;not connect&quot;); 
  if(isset($_POST['submit'])){
  $check=implode(',',&quot;$_POST,[ch]&quot;);
  $country=$_POST[&quot;country&quot;];
  $sql =$db-&gt;query(&quot;INSERT INTO  'test' ('checkbox','country')VALUES('$check','$country')&quot;);
  if($qry&gt;0){
  echo '&lt;script&gt; alert(&quot;Data is submited&quot;);&lt;/script&gt;';
  }else{
  echo '&lt;script&gt; alert (&quot;Data is not submited&quot;);&lt;/script&gt;';
  }
  }
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Demo&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;form action=&quot;&quot; method=&quot;POST&quot;&gt;
  &lt;input type=&quot;checkbox&quot; name=&quot;ch[]&quot; value=&quot;PHP&quot; /&gt; PHP&lt;br&gt;
  &lt;input type=&quot;checkbox&quot; name=&quot;ch[]&quot; value=&quot;JAVA&quot; /&gt; JAVA&lt;br&gt;
  &lt;input type=&quot;checkbox&quot; name=&quot;ch[]&quot; value=&quot;CSS&quot; /&gt; CSS&lt;br&gt;
  &lt;input type=&quot;checkbox&quot; name=&quot;ch[]&quot; value=&quot;HTML&quot; /&gt; HTML&lt;br&gt;
  &lt;input type=&quot;checkbox&quot; name=&quot;ch[]&quot; value=&quot;CORE PHP&quot; /&gt;CORE PHP&lt;br&gt;
  &lt;select name=&quot;country&quot;&gt;
  &lt;input type=&quot;submit&quot; name=&quot;send&quot; value=&quot;Gönder&quot; /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>