title: Multiple values into MySQL from checkbox
body: <p>i have an html page, where there is a form and saves the results into MySQL. The problem is that the checkbox, saves only one value on the MySQL table. What do i have to do, in order to save multiple values inside the db column? </p>
  
  <p>HTML CODE: </p>
  
  <pre><code>&lt;fieldset&gt;
  &lt;input type = "checkbox" name = "rating[]" value = "Homepage"&gt;Homepage
  &lt;input type = "checkbox" name = "rating[]" value = "Facilities"&gt; Facilities 
  &lt;input type = "checkbox" name = "rating[]" value = "Reservation"&gt; Reservation 
  &lt;input type = "checkbox" name = "rating[]" value = "Contact"&gt; Contact  
  &lt;input type = "checkbox" name = "rating[]" value = "current"&gt; The current one  
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>PHP CODE:</p>
  
  <pre><code>$con=mysqli_connect("xxx","zzz","yyy","xxx");
  
  if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
  
  $firstname = mysqli_real_escape_string($con, $_POST['firstname']);
  $lastname = mysqli_real_escape_string($con, $_POST['lastname']);
  $password = mysqli_real_escape_string($con, $_POST['password']);
  $email = mysqli_real_escape_string($con, $_POST['email']);
  $address = mysqli_real_escape_string($con, $_POST['address']);
  $postcode = mysqli_real_escape_string($con, $_POST['postcode']);
  $country = mysqli_real_escape_string($con, $_POST['country']);
  $phonenumber = mysqli_real_escape_string($con, $_POST['phonenumber']);
  $rating = mysqli_real_escape_string($con, $_POST['rating_value']);
  $subscribe = mysqli_real_escape_string($con, $_POST['subscribe']);
  
  
  for($i=0; $i&lt;count($rating); $i++) { $rating_value &amp;= $rating[$i];}
  
  $sql="INSERT INTO customers (firstname, lastname, password, email, address, postcode,     country, phonenumber, rating, subscribe)
  VALUES ('$firstname', '$lastname', '$password', '$email', '$address', '$postcode','$country', '$phonenumber', '$rating_value', '$subscribe')";
  
  
  if (!mysqli_query($con,$sql)) {
  die('Error: ' . mysqli_error($con));
  }
  echo " Success!";
  </code></pre>