如何根据所选教师列出车辆
我有一个列表框,当用户选择教师时显示车辆列表。我只想根据用户选择的教师列出车辆。
<td>No</td>
<td>Registration No</td>
<?php
$count = 0;
$db = mysql_connect('localhost','root')
or die ("unable to connect");
mysql_select_db('fyp',$db) or die ("able to select");
$sql="SELECT * FROM vehicle_record";
$result = mysql_query($sql) or die ("Query failed!");
while($row = mysql_fetch_array($result)){
$count = $count + 1;
?>
<select name="faculty" >
<option value="" selected>-- Please Select --</option>
<option>City Campus</option>
<option>MFI</option>
<option>BMI</option>
<option>MSI</option>
<option>MIAT</option>
<option>MICET</option>
<option>MIMET</option>
<option>RCMP</option>
</select>
i have a list box to show the list of vehicle when user select the faculty. i want to list only the vehicle based on the selected faculty by user.
<td>No</td>
<td>Registration No</td>
<?php
$count = 0;
$db = mysql_connect('localhost','root')
or die ("unable to connect");
mysql_select_db('fyp',$db) or die ("able to select");
$sql="SELECT * FROM vehicle_record";
$result = mysql_query($sql) or die ("Query failed!");
while($row = mysql_fetch_array($result)){
$count = $count + 1;
?>
<select name="faculty" >
<option value="" selected>-- Please Select --</option>
<option>City Campus</option>
<option>MFI</option>
<option>BMI</option>
<option>MSI</option>
<option>MIAT</option>
<option>MICET</option>
<option>MIMET</option>
<option>RCMP</option>
</select>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我无法完全理解您的问题,但我假设您希望在提交表单后选择车辆设施,您将 javascript 用于此目的:
但是,如果您的意思是如何显示来自数据库的设施,那么您可以像这样:
I could not get your question fully but I assume you want the vehicle facility to be selected after form is submitted, you put javascript to use for that:
However, if you meant how to show facilities coming from database, then you can go like this:
我想你有 2 个选择,一个用于教师,一个用于车辆
Javascript 代码
和 getVechiles.php
I suppose you have 2 select one for faculty and one for vehicle
Javascript Code
and getVechiles.php