ドライバーの選択ボックスで変更時に開始するajaxを使用する必要があります。それは次のようになります。あなたのシナリオでは
<select onchange="getval(this.value)">
<option value="1">One</option>
<option value="2">Two</option>
</select>
が、それは次のようになります。あなたのコントローラに
function getval(driverid){
$.ajax({url: "controller/newmethod/"+driverid, success: function(result){
//now populate the mobile number in the select box.
}});
}
:
<select name="dname" class="form-control" onchange="getval(this.value)">
// <?php
foreach($results_drivers as $row)
{
echo '<option value="'.$row->id.'">'.$row->name.'</option>';
}
?>
</select>
が続いてjqueryの関数を記述
Public function newmethod($id){
$driver_data = //query to get data from your table with where cluase
/// where id = $id
//and then get the data in format you like, let say array
print_r($driver_data);exit;
}
Now in jquery , you have data of driver in result variable that is passed as a parameter in function . now that should be easy for you . if you still have question or problem implementing it , let me know. It is easy task and you are going to use it in future a lot of times. Thats why I want you to do it your self and just telling you the methodology.
私はこの質問を改善するために最善を尽くしましたが、それはまだ不明です。 –
今私は質問したいことがはっきりしていると思います。 –