Dynamic <select> - How to deal with?

Dynamic <select> - How to deal with?

Hi,

I have employee evaluation for and it's populating the data from database and for every element of the evaluation there is a <select> to choose the employee rating.

I want to know how can I implement this? I need to show the first question and when the user selects from the dropdown then only it will show the next question until last? How to name the <select>? will all have same name?

here is my code:

  1. <table data-role="table" id="movie-table" data-mode="reflow" class="ui-body-d ui-shadow table-stripe ui-responsive">
  2. <thead>
  3. <tr>
  4.     <th data-priority="1"></th>
  5.     <th data-priority="2"></th>
  6. </tr>
  7. </thead>
  8. <tbody>
  9. <?php
  10. // get leave details;
  11. $mysql_query = $mysql_connection->prepare('CALL sp_web_get_employee_evaluation_elements_by_guid(:param_employee_evaluation_guid)');
  12. $mysql_query->bindParam(':param_employee_evaluation_guid', $evaluation_guid, PDO::PARAM_STR);

  13. $mysql_query->execute();

  14. if ($mysql_query->rowCount() <= 0)
  15. {
  16. exit(header("Location: index.php"));
  17. }

  18. while($mysql_row = $mysql_query->fetch()) {
  19. ?>
  20. <tr>
  21.     <td style="padding: 10px;"><b>ID:</b></td>
  22.     <td style="padding: 10px;"><?php echo $mysql_row["employee_evaluation_details_id"]; ?></td>
  23. </tr>
  24. <tr>
  25.     <td style="padding: 10px;"><b>Element</b></td>
  26.     <td style="padding: 10px;"><?php echo $mysql_row["employee_evaluation_element_name"]; ?></td>
  27. </tr>
  28. <tr>
  29.     <td style="padding: 10px;"><b>Rating :</b></td>
  30.     <td style="padding: 10px;">
  31.         &lt;select name="cboRating" id="cboRating" data-native-menu="false" required>
  32.             &lt;option value="">[Select..]&lt;/option>
  33.             <?php
  34.               $mysql_rating_category_command = "CALL sp_web_populate_evaluation_rating_category()";
  35.               $mysql_rating_category_query = $mysql_second_connection->prepare($mysql_rating_category_command);
  36.               $mysql_rating_category_query->execute();
  37.             
  38.               while($mysql_rating_category_row = $mysql_rating_category_query->fetch())
  39.               {
  40.             ?>
  41.             &lt;option value="<?php echo $mysql_rating_category_row["evaluation_rating_category_id"]; ?>"><?php echo $mysql_rating_category_row["evaluation_rating_category_name"]; ?>&lt;/option>
  42.             <?php } ?>
  43.         &lt;/select>
  44.     </td>
  45. </tr>
  46. <?php } ?>
  47. </tbody>
  48. </table>


Thanks,
Jassim