Dynamic <select> - How to?
-
Hi, I have employee evaluation for and it's populating the data from database and for every element of the evaluation there is a to choose the employee rating. I want to know how can I implement this? How to name it? will all have same name? here is my code: 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()) { ?> ID: Element Rating : <select name="cboRating" id="cboRating" data-native-menu="false" required> <option value="">[Select..]</option> prepare($mysql_rating_category_command); $mysql_rating_category_query->execute(); while($mysql_rating_category_row = $mysql_rating_category_query->fetch()) { ?> <option value=""></option> </select> Thanks, [Jassim](https://www.softnames.com) Technology News @ www.JassimRahma.com
-
Hi, I have employee evaluation for and it's populating the data from database and for every element of the evaluation there is a to choose the employee rating. I want to know how can I implement this? How to name it? will all have same name? here is my code: 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()) { ?> ID: Element Rating : <select name="cboRating" id="cboRating" data-native-menu="false" required> <option value="">[Select..]</option> prepare($mysql_rating_category_command); $mysql_rating_category_query->execute(); while($mysql_rating_category_row = $mysql_rating_category_query->fetch()) { ?> <option value=""></option> </select> Thanks, [Jassim](https://www.softnames.com) Technology News @ www.JassimRahma.com
That seems fine, where did you get suck? If the rating has been provided then you can simply fetch the record for rating (fetch that column in MySQL) and render it in HTML. There is no need for select at all, otherwise if you want to provide updating of it too, then still create a rating select, but chose
selected
attribute for a special one that was selected by user.The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
That seems fine, where did you get suck? If the rating has been provided then you can simply fetch the record for rating (fetch that column in MySQL) and render it in HTML. There is no need for select at all, otherwise if you want to provide updating of it too, then still create a rating select, but chose
selected
attribute for a special one that was selected by user.The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
I tried below code but getting: SELECT is not an array although my html output is showing correct result like this:
Work Performance
Efficient execution of duties.
<select name="cboRating\[4613\]" id="cboRating\[4613\]" data-native-menu="false" required> <option value="">\[Select..\]</option> <option value="1">Outstanding</option> <option value="2">Exceeds Expectations</option> <option value="3">Meets Expectations</option> <option value="4">Needs Improvement</option> <option value="5">Unsatisfactory</option> </select>
Technical Knowledge and Skill
Mastery of job knowledge and skills required to perform the duties of the position.
<select name="cboRating\[4614\]" id="cboRating\[4614\]" data-native-menu="false" required> <option value="">\[Select..\]</option> <option value="1">Outstanding</option> <option value="2">Exceeds Expectations</option> <option value="3">Meets Expectations</option> <option value="4">Needs Improvement</option> <option value="5">Unsatisfactory</option> </select>
here is my code:
if (is_array( $_POST['cboRating']))
{
foreach($_POST['cboRating'] as $key=>$value)
{
echo "Key : " . $key . "";
echo "value : " . $value . "";
}
}
else
{
echo "SELECT is not an array";
}Technology News @ www.JassimRahma.com