I have two variables set up to populate a dynamic dropdown. The variables are each arrays and run through for each
. The first variable queries the db to find out what staff member is currently assigned and then display that name. This name is shown in the first position of the dropdown.
The second variable queries the db to see what other staff members are available to be assigned. Those results are to be shown below the currently assigned staff member.
The issue I have is trying to get this to properly display in a list inside of the dynamic dropdown. Right now, the results are showing up where the first variable is in front of each listing for the second variable
How do I get this to properly show?
The PHP
$id=$xxxx_t->_id; $Current_Staffing = $wpdb->get_results("SELECT First_Name, Last_Name FROM Staff_Table, Staff_List ORDER BY TimeStamp DESC LIMIT 1"); $On_Duty = $wpdb->get_results("SELECT Staff_Id, First_Name, Last_Name FROM Staff foreach($On_Duty as $person){ $f_name_option = $person->Staff_First_Name; $person->First_Name $lname_option = $person->Last_Name; $staff_id = $person->Staff_id; echo("<option value="$staff_id, $id") foreach($Current_Staffing as $staff){ $staff->First_Name; $staff->Last_Name; } echo(">$staff->First_Name $staff->Last_Name<br><br>$f_name_option $l_name_option</option>"); }
EDIT 1 Since someone's feelings got hurt when a suggestion was made, tried and then didnt work lets give credit to user GetSet who had me change a line to echo("<option value=\"$staff_id, $id\"")
. As can be seen in teh comments below, it make no changes. There credit given as requested
没有评论:
发表评论