What are the best practices for integrating radio buttons into SQL results in PHP?

When integrating radio buttons into SQL results in PHP, it is important to dynamically generate the radio buttons based on the SQL data retrieved. This can be achieved by looping through the SQL results and creating a radio button for each record. Additionally, assigning a unique value to each radio button based on the SQL data will allow for easy selection and processing of the user's choice.

<?php
// Assume $sqlResults is an array containing SQL data
foreach ($sqlResults as $result) {
    echo '<input type="radio" name="option" value="' . $result['id'] . '">' . $result['name'] . '<br>';
}
?>