What are the potential pitfalls of using radio buttons in PHP forms?

One potential pitfall of using radio buttons in PHP forms is that if the user does not select any option, there may not be a default value selected. To solve this issue, you can set a default value for the radio buttons in the PHP code to ensure that at least one option is always selected.

<input type="radio" name="gender" value="male" <?php if(isset($_POST['gender']) && $_POST['gender'] == 'male') echo 'checked'; else echo 'checked'; ?>> Male
<input type="radio" name="gender" value="female" <?php if(isset($_POST['gender']) && $_POST['gender'] == 'female') echo 'checked'; ?>> Female