How can radio buttons be preselected after submission in a PHP form?

To preselect radio buttons after submission in a PHP form, you can use the `checked` attribute in the input tag and set it based on the value received from the form submission. You can check the submitted value against the predefined values for each radio button and add the `checked` attribute to the corresponding input tag.

<form method="post">
    <input type="radio" name="option" value="option1" <?php if(isset($_POST['option']) && $_POST['option'] == 'option1') echo 'checked'; ?>> Option 1
    <input type="radio" name="option" value="option2" <?php if(isset($_POST['option']) && $_POST['option'] == 'option2') echo 'checked'; ?>> Option 2
    <input type="submit" value="Submit">
</form>