troubleshooting Question

One list box dependent on another

Avatar of David Schure
David Schure asked on
PHP
4 Comments1 Solution11 ViewsLast Modified:
When I select a name from the left list I want the right one to update accordingly. Right now nothing is happening.


<div id="tlist">   
<?php
$result = mysqli_query($con, "SELECT tbl_therapist.therapist_id, tbl_therapist.therapist_name FROM tbl_therapist ORDER BY therapist_name ASC;");
?>
<label><strong>THERAPIST</strong></label><BR>
<select name="my_therapist" id="my_therapist" size="10">
<?php
while ($row = mysqli_fetch_array($result)) {
    printf("<option value='%s'>%s</option>", $row['therapist_id'], $row['therapist_name']);
}
?>
</select>
</div> 

<div id="results">
 <?php
$result = mysqli_query($con, "SELECT tbl_client.client_id, tbl_client.client_name FROM tbl_client INNER JOIN tbl_therapist_client
ON tbl_therapist_client.client_id=tbl_client.client_id WHERE tbl_therapist_client.therapist_id = $therapist_id ORDER BY client_name ASC;");
?>
<label><strong>CLIENTS</strong></label><BR>
<select name="my_clients" id="my_clients" size="10">
<?php
while ($row = mysqli_fetch_array($result)) {
    printf("<option value='%s'>%s</option>", $row['client_id'], $row['client_name']);
}
?>
</select>   
</div>    
The left one is therapist.  the right one clients
ASKER CERTIFIED SOLUTION
Daniel PineaultPresident / Owner CARDA Consultants Inc.
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros