我正在创建一个表(职位空缺列表),每一行中的每一列都有其自己的链接(另一个php文件)。当用户单击“作业名称”时,它将被定向到“ job1.php”(例如作业编号1)。 共3页: (1)职位列表页面->(2)职位详细信息+应用按钮->(3)申请表格
问题:我希望职位名称自动填写在(3)“职位名称”输入框中 当用户单击(2)中的“应用”按钮时。 php如何知道哪个 在(1)/(2)步骤中单击作业?请告知。
谢谢
***我使用while($row = mysqli_fetch_array($result)
从SQL打印表列表。
(1)职位列表页面PHP
<!DOCTYPE html>
</head>
<body>
<table border="1">
<tr>
<td>Job Serial Number</td>
<td>Job Name</td>
<td>Job Date</td>
</tr>
<?php
$conn=mysqli_connect('localhost','root','admin','function1');
$sql = "SELECT * FROM joblist";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($result)) {
echo "<tr>
<td>";
printf("%s",$row["jobno"]);
echo "</a></td>
<td><a href='job";
printf("%s",$row["jobno"]);
echo ".php'>";
printf("%s",$row["jobname"]);
echo "</td>
<td>";
printf("%s",$row["jobdate"]);
echo "</td>
</tr>";
}
?>
</table>
</body>
</html>
(2)职位详细信息+应用按钮PHP
<!DOCTYPE html>
<html>
<head>
<?php
$conn=mysqli_connect('localhost','root','admin','function1');
$sql = "SELECT * FROM joblist";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_array($result);
?>
</head>
<body>
<?php
echo '<h1>';
printf("%s",'Job Name:'.$row["jobname"]);
echo '</h1><br>';
echo 'Details: Clean the floor';
echo '<br>';
printf("%s",'Job Date:'.$row["jobdate"]);
?>
<br>
<form action="jobregister.php" method="post">
<button type="submit">Click me to apply</button>
</form>
</body>
</html>
(3)表格来注册PHP
<!DOCTYPE html>
<html>
<head>
<?php
$conn=mysqli_connect('localhost','root','admin','function1');
if ($conn->connect_error) die($conn->connect_error);
$sql = "SELECT * FROM joblist";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_array($result);
?>
</head>
<body>
<form method="post" action="registered.php">
Job Name:<input type="text" name="stdjob"><br>
Your Name:<input type="text" name="stdname"><br>
<button type="submit" name="submit">Submit Application</button>
</form>
</body>
</html>