title: how do i store the value of stars rating in mysql database
body: <p>Hi I have form that contains Ratings, Name, email, and comments. I am able to insert the user input data for  name, email and comments. But don't know how to store the star ratings in database. Anyone please help me. thanks</p>
  
  <pre><code>      &lt;?php
  if(isset($_POST['submit']))
  {
  
  $name = $_POST['name'];
  $email = $_POST['email'];
  $comments = $_POST['comments'];
  $ratings = $_POST['ratings'];
  $link = mysqli_connect("localhost", "root", "", "imakr");
  
  /* check connection */
  if (mysqli_connect_errno()) {
      printf("Connect failed: %s\n", mysqli_connect_error());
      exit();
  }
  
  
  $res = mysqli_query($link, "insert into imakr.customer_review(name, email, comments, ratings) values('$name','$email','$comments', '$ratings')");
  
      if($res)
      {
          echo "Your feedback is saved";
      }
      else
      {
          echo " OOPs!! there is some error. Please check the fields";
      }
  
  }
  ?&gt;
  
  &lt;form id="customer_review" name="cust_rev"action="" method="post" onsubmit="return validate()"&gt;
    &lt;table width="535" border="0"&gt;
      &lt;tr&gt;
        &lt;td&gt;Rate This Product:
        &lt;/td&gt;
        &lt;td&gt;
        &lt;span id="rateStatus"&gt;Rate Me...&lt;/span&gt;
  &lt;span id="ratingSaved"&gt;Rating Saved!&lt;/span&gt; 
  
  &lt;div id="rateMe" title="Rate Me..."&gt;
      &lt;a onclick="rateIt(this)" id="_1" title="Poor" onmouseover="rating(this)" onmouseout="off(this)"&gt;&lt;span class="ratings"&gt;1&lt;/span&gt;&lt;/a&gt;
      &lt;a onclick="rateIt(this)" id="_2" title="Not Bad" onmouseover="rating(this)" onmouseout="off(this)"&gt;&lt;span class="ratings"&gt;2&lt;/span&gt;&lt;/a&gt;
      &lt;a onclick="rateIt(this)" id="_3" title="Pretty Good" onmouseover="rating(this)" onmouseout="off(this)"&gt;&lt;span class="ratings"&gt;3&lt;/span&gt;&lt;/a&gt;
      &lt;a onclick="rateIt(this)" id="_4" title="Excellent" onmouseover="rating(this)" onmouseout="off(this)"&gt;&lt;span class="ratings"&gt;4&lt;/span&gt;&lt;/a&gt;
      &lt;a onclick="rateIt(this)" id="_5" title="Marvellous" onmouseover="rating(this)" onmouseout="off(this)"&gt;&lt;span class="ratings"&gt;5&lt;/span&gt;&lt;/a&gt;
  &lt;/div&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td width="129"&gt;&lt;span class="titles"&gt;Name&lt;/span&gt;&lt;span class="star"&gt;*&lt;/span&gt;:&lt;/td&gt;
        &lt;td width="396"&gt;&lt;label for="name"&gt;&lt;/label&gt;
        &lt;input type="text" name="name" id="name" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;span class="titles"&gt;Email&lt;/span&gt;&lt;span class="star"&gt;*&lt;/span&gt;:&lt;/td&gt;
        &lt;td&gt;&lt;label for="email"&gt;&lt;/label&gt;
        &lt;input type="text" name="email" id="email" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td height="61"&gt;Comments:&lt;/td&gt;
        &lt;td&gt;&lt;label for="comments"&gt;&lt;/label&gt;
        &lt;textarea name="comments" id="comments" cols="45" rows="5" onchange="maxlength('comments', 500)"&gt;&lt;/textarea&gt;&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td&gt;&lt;input type="submit" name="submit" id="submit" value="Submit" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
    &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;/form&gt;
  </code></pre>