title: how to store all checkbox values in array in php
body: <p>i m trying to store checkbox values inside variable <code>$days</code> but when i store this value to database it just store the last selected checkbox inside the database... please help me to sort out the code so i can get all selected values</p>
  
  <pre><code>    &lt;?php
  
     if (isset($_POST['days'])) {
      foreach ($_POST['days'] as $day) {
          $days = " " . $day;
      }
  } else {
      $days = "not available";
  }  
  ?&gt;
   &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post" enctype="multipart/form-data"&gt;
  &lt;tr&gt;
  &lt;td&gt;Select Days :&lt;/td&gt;
  &lt;td&gt;
      &lt;input type="checkbox" name="days[]" value="Sunday"&gt;Sunday
      &lt;input type="checkbox" name="days[]" value="Monday"&gt;Monday
      &lt;input type="checkbox" name="days[]" value="Tuesday"&gt;Tuesday
      &lt;input type="checkbox" name="days[]" value="Wednesday"&gt;Wednesday
      &lt;input type="checkbox" name="days[]" value="Thursday"&gt;Thursday
      &lt;input type="checkbox" name="days[]" value="Friday"&gt;Friday
      &lt;input type="checkbox" name="days[]" value="Saturday"&gt;Saturday
      &lt;input type="checkbox" name="days[]" value="All Days"&gt;All Days
  &lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
  </code></pre>
  
  <p>
           </p>