我正在制作一个页面,该页面将获取我的所有数据库值。我希望页面从数据库自动获取Driver_id和Vehicle_id的值,用户需要知道自己的ID和密钥是什么。但是我被困在这里。
我正在使用的工具是phpMyAdmin。
下面是我的表格代码:
<!doctype html>
<html>
<style>
<table>
<th>Vehicle ID</th>
<th>Vehicle Model</th>
<th>Vehicle Color</th>
<th>Plate Number</th>
<th>Seats</th>
<th>Driver ID</th>
<th> </th>
<?php
$link=mysqli_connect("localhost","root","","jomsewa");
mysqli_select_db($link,"jomsewa") or die(mysqli_error($link));
$select = "SELECT * FROM vehicle";
$row = mysqli_query($link,$select);
while ($array = mysqli_fetch_array($row)){
echo "<tr><td>".$array['Vehicle_id']."</td>
<td>".$array['Vehicle_model']."</td>
<td>".$array['Vehicle_color']."</td>
<td>".$array['Vehicle_model']."</td>
<td>".$array['Vehicle_seats']."</td>
<td>".$array['Driver_id']."</td>
<td><a href='Dmaintenance.php?Driverid=".$array['Driver_id']."'>Select</a></td>"."</tr>";
}
mysqli_close($link);
?>
</table>
</body>
</html>
链接链接到Dmaintenance.php:
<?php
$link=mysqli_connect("localhost","root","","jomsewa");
if (!$link)
{
echo "Failed to connect to database: " . mysqli_connect_error();
}
mysqli_select_db($link,"jomsewa") or die(mysqli_error($link));
?>
<h3>Please update your maintenance details in the form below.</h3>
<form action="maintenance.php" method="post">
<fieldset>
<legend>Vehicle Maintenance Information:</legend>
<table cellpadding="10">
<tr>
<td>
<?php
if(isset($GET['Driver_id']))
{
$txt = $GET['Driver_id'];
while($row = mysqli_fetch_array($result))
{
echo "<td>".$row['Vehicle_id']."</td>";
echo "<td>".$row['Driver_id']."</td>";
}
}?></td>
</tr>
我想要的是,当单击下一页上的一个特定行链接时,它必须自动显示我选择的行内容。
潇湘沐