Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Dynamic <select> - How to?

Dynamic <select> - How to?

Scheduled Pinned Locked Moved Web Development
databasequestionc++phpsharepoint
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • J Jassim Rahma

      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

      A Offline
      A Offline
      Afzaal Ahmad Zeeshan
      wrote on last edited by
      #2

      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 !~

      J 1 Reply Last reply
      0
      • A Afzaal Ahmad Zeeshan

        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 !~

        J Offline
        J Offline
        Jassim Rahma
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups