I have 2 dropdown lists-
1) First dropdown list for client ID
2) Second dropdown list for client name
What I want is when user selects client id then in the another dropdown client name should be selected who having that selected id.
Second Thing I want that If user selects client name then in the client id dropdown that client's client id should be selected.
What I have done so far-
<select class="form-control" id="client_id">
<?php
while($c_id=mysql_fetch_array($client_id))
{
echo "<option>".$c_id['ID']."</option>";
}
?>
</select>
<select class="form-control" id="client_name">
<?php
while($c_name=mysql_fetch_array($client_name))
{
echo "<option value='".$c_name['ID']."'>".$c_name['display_name']."</option>";
}
?>
</select>
Jquery -
$('#client_id').change(function(){
//Client name should be select here base on selected id
});
$('#client_name').change(function(){
//Client id should be select here base on selected client name
});
Please help me.
Thanks.