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:
- <table data-role="table" id="movie-table" data-mode="reflow" class="ui-body-d ui-shadow table-stripe ui-responsive">
- <thead>
- <tr>
- <th data-priority="1"></th>
- <th data-priority="2"></th>
- </tr>
- </thead>
- <tbody>
- <?php
- // get leave details;
- $mysql_query = $mysql_connection->prepare('CALL sp_web_get_employee_evaluation_elements_by_guid(:param_employee_evaluation_guid)');
- $mysql_query->bindParam(':param_employee_evaluation_guid', $evaluation_guid, PDO::PARAM_STR);
- $mysql_query->execute();
- if ($mysql_query->rowCount() <= 0)
- {
- exit(header("Location: index.php"));
- }
- while($mysql_row = $mysql_query->fetch()) {
- ?>
- <tr>
- <td style="padding: 10px;"><b>ID:</b></td>
- <td style="padding: 10px;"><?php echo $mysql_row["employee_evaluation_details_id"]; ?></td>
- </tr>
- <tr>
- <td style="padding: 10px;"><b>Element</b></td>
- <td style="padding: 10px;"><?php echo $mysql_row["employee_evaluation_element_name"]; ?></td>
- </tr>
- <tr>
- <td style="padding: 10px;"><b>Rating :</b></td>
- <td style="padding: 10px;">
- <select name="cboRating" id="cboRating" data-native-menu="false" required>
- <option value="">[Select..]</option>
- <?php
- $mysql_rating_category_command = "CALL sp_web_populate_evaluation_rating_category()";
- $mysql_rating_category_query = $mysql_second_connection->prepare($mysql_rating_category_command);
- $mysql_rating_category_query->execute();
-
- while($mysql_rating_category_row = $mysql_rating_category_query->fetch())
- {
- ?>
- <option value="<?php echo $mysql_rating_category_row["evaluation_rating_category_id"]; ?>"><?php echo $mysql_rating_category_row["evaluation_rating_category_name"]; ?></option>
- <?php } ?>
- </select>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
Thanks,
Jassim