如何从输入类型的无线电获取值并使用PHP将其插入数据库?

I'm new to Web Development, so i have this problem. I'm trying to make star rating system with inputs like this:

<fieldset class="rating">
    <input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
    <input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
    <input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
    <input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
    <input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
</fieldset>

I found this code for stars, so now i want to insert this into database when a user selects number of stars he wants. I want it to be without submit button, so i guess i have to use Javascript and Ajax. How do i take values from this inputs (the numbers from 1 to 5) and store them in database? So when he clicks, for example star 4, it takes its value and inserts it into database. If you have some good links that can help me with this, i would apreciate it very much.

Here is a php, html and jquery which will accomplish what you're trying and maybe this is a good start.

<?php
 if ((($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST))) {
    // echo the values from the select facet page
    echo "You have selected " . $_POST['rating']. "<br";

    //do your db actions here
    }
 ?>

<!doctype html>
 <html>
  <head>
  <meta charset="utf-8">
  <title>Untitled Document</title>
 </head>

<body>
 <form  method="post" name="form1" id="form1">
  <p>
   <fieldset class="rating">
    <input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
    <input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
    <input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
    <input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
    <input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
   </fieldset>
  </form>
  <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
  <script>
   $(document).ready(function() {
    $('input[name=rating]').change(function(){
     $('form').submit();
    });
   });
  </script>
 </body>
</html>

I took this from https://forums.adobe.com/thread/1832611 changed a few lines of code.