What are the potential pitfalls of using checkboxes for user input in PHP quiz forms?

Potential pitfalls of using checkboxes for user input in PHP quiz forms include: 1. Users may select multiple options when only one answer is allowed. 2. Users may not select any option when a selection is required. 3. Users may manipulate the form data to select incorrect options. To solve these issues, you can use radio buttons instead of checkboxes for single-choice questions and validate the form data to ensure a selection is made.

<form method="post">
    <input type="radio" name="question1" value="option1"> Option 1<br>
    <input type="radio" name="question1" value="option2"> Option 2<br>
    <input type="radio" name="question1" value="option3"> Option 3<br>
    <input type="submit" name="submit" value="Submit">
</form>

<?php
if(isset($_POST['submit'])){
    $answer = $_POST['question1'];
    
    if(empty($answer)){
        echo "Please select an option.";
    } else {
        // Process the answer
    }
}
?>