What is the correct syntax for handling radio buttons in PHP forms?

When handling radio buttons in PHP forms, you need to ensure that only one option can be selected at a time. This can be achieved by giving each radio button the same name attribute and different values. When the form is submitted, you can use PHP to check which radio button was selected by accessing the value of the selected option.

<form method="post" action="process_form.php">
  <input type="radio" name="color" value="red"> Red<br>
  <input type="radio" name="color" value="blue"> Blue<br>
  <input type="radio" name="color" value="green"> Green<br>
  <input type="submit" value="Submit">
</form>

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  $selected_color = $_POST['color'];
  echo "You selected: " . $selected_color;
}
?>