我是php
的初学者,我编写了一个可点击的搜索结果函数。我的问题是如何点击一个特定的搜索项目,可以通过完整的详细信息点击并在另一个页面中打开。在客户端点击一个搜索项后,searresults.php
页面或目标页面的代码下方:
<!-- language: lang-html -->
<!DOCTYPE HTML>
<html>
<head>
<title>Search Results</title>
</head>
<body>
<h3>Search Results</h3>
<?php
$con = mysqli_connect("localhost","root","","1");
$excursion_id = $_GET['excursion_id'];
$sql = "select * from excursionitem where excursion_id = '$excursion_id'";
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result))
{
$Item_Name = $row['Item_Name'];
$Description = $row['Description'];
$Price = $row['Price'];
$excursion_id = $row['excursion_id'];
echo '$excursion_id' ;
}
?>
</body>
</html>
非常感谢您的帮助。
答案 0 :(得分:0)
如果您只想列出hyperlink
可点击列表,并重定向到其他页面。
试一试:
while($row = mysqli_fetch_array($result))
{
$Item_Name = $row['Item_Name'];
$Description = $row['Description'];
$Price = $row['Price'];
$excursion_id = $row['excursion_id'];
?>
<a href="OTHERPAGE.php?id=<?=$excursion_id?>">More datails</a><br />
<?php
}
是吗?