如何在没有 PHP 输入标签的情况下通过 POST 将值发送到另一个页面?我尝试过这种方式,但也没有用。<?phpinclude("database/config.php");include("database/opendb.php");include("functions.php");if (isset($_POST["totalHobbies"])) { $par = $_POST["totalHobbies"];}$query = "SELECT firstname, lastname, hobbies, id ";$query .= "FROM persons ";$query .= "WHERE hobbies = ? ";$preparendquery = $dbaselink->prepare($query);$preparendquery->bind_param("i", $par);$preparendquery->execute();if ($preparendquery->errno) { echo "Fout bij uitvoeren commando". "<br>";} else { $result = $preparendquery->get_result(); if ($result->num_rows === 0) { echo "Geen rijen gevoenden" . "<br>" ; } else { while ($row = $result->fetch_assoc()) { // here is the problem echo "<form action=\"details.php\" method='POST' >"; //refer to details.php page $id = $row["id"]; echo "<a href=\"details.php?id= " . $row['id'] . " \">" . fullname($row['firstname'], $row['lastname']). "</a>". "<br>"; echo "<input type=\"hidden\" name = \"id\" value= '$id'> </input>"; echo "</form>"; }; }}$preparendquery->close();echo"<br><button onclick=\"location.href='index.html'\">Back</button>";include("database/closedb.php");?>
2 回答
- 2 回答
- 0 关注
- 134 浏览
添加回答
举报
0/150
提交
取消