<div class="demo-container d-flex justify-content-center">
<form action="" method="post">
<div class="radio-buttons-container">
<input type="radio" id="star_5" name="stars" value="5" <?=$_POST['stars']=="5" ? "checked" : ""?> /> <label for="star_5" title="Awesome"></label>
<input type="radio" id="star_4.5" name="stars" value="4.5" <?=$_POST['stars']=="4.5" ? "checked" : ""?> /> <label for="star_4.5" class="half"></label>
<input type="radio" id="star_4" name="stars" value="4" <?=$_POST['stars']=="4" ? "checked" : ""?> /> <label for="star_4"></label>
<input type="radio" id="star_3.5" name="stars" value="3.5" <?=$_POST['stars']=="3.5" ? "checked" : ""?> /> <label for="star_3.5" class="half"></label>
<input type="radio" id="star_3" name="stars" value="3" <?=$_POST['stars']=="3" ? "checked" : ""?> /> <label for="star_3"></label>
<input type="radio" id="star_2.5" name="stars" value="2.5" <?=$_POST['stars']=="2.5" ? "checked" : ""?> /> <label for="star_2.5" class="half"></label>
<input type="radio" id="star_2" name="stars" value="2" <?=$_POST['stars']=="2" ? "checked" : ""?> /> <label for="star_2"></label>
<input type="radio" id="star_1.5" name="stars" value="1.5" <?=$_POST['stars']=="1.5" ? "checked" : ""?> /> <label for="star_1.5" class="half"></label>
<input type="radio" id="star_1" name="stars" value="1" <?=$_POST['stars']=="1" ? "checked" : ""?> /> <label for="star_1"></label>
<input type="radio" id="star_0.5" name="stars" value="0.5" <?=$_POST['stars']=="0.5" ? "checked" : ""?> /> <label for="star_0.5" class="half"></label>
</div>
<div class="container my-3">
<div class="col-md-12 text-center">
<input class="btn btn-primary" type="submit" name="submit" value="Submit">
</div>
</div>
</form>
</div>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST["stars"])) {
echo "<div class='results-content'>Your selected star value is: <strong>" . $_POST["stars"] . "</strong></div>";
}
else {
echo "<div class='results-content'>Please select a star value </div>";
}
}
?>
</div>