Php 使用href传递$\u GET[]的值不起作用
我使用网页上的GET来处理对MYSQL查询应用过滤器的问题,MYSQL查询显示数据库中的项目,然后信息显示在一个div中,在div的底部我看到了这个Php 使用href传递$\u GET[]的值不起作用,php,html,mysql,Php,Html,Mysql,我使用网页上的GET来处理对MYSQL查询应用过滤器的问题,MYSQL查询显示数据库中的项目,然后信息显示在一个div中,在div的底部我看到了这个 <a href="tyreDetails.php?id=<?php echo $product["recid"]; ?>"> <button class="btn btn-default btn-sm btn-primary">Details</button> </a> 然后
<a href="tyreDetails.php?id=<?php echo $product["recid"]; ?>">
<button class="btn btn-default btn-sm btn-primary">Details</button>
</a>
然后在另一页上使用。使用项目的id再次显示信息
if (isset($_GET['id'])) {
$id = mysqli_escape_string($db, $_GET['id']);
$featuredSql = "SELECT t.*, s.quantity, s.rrp AS nRetailPrice, r.city AS city_name, ts.thumbnail as tread_thumbnail, ts.bigpic as tread_bigpic, t.rating FROM tyres t INNER JOIN stocklevels s
ON t.stockcode=s.stockcode LEFT JOIN tyre_treads ts ON t.treadid=ts.recid LEFT JOIN reseller r ON s.city=r.recid WHERE s.quantity>0 AND s.rrp>0 ";
// $featuredResult = mysqli_query($db, $featuredSql);
if ($id != 'Any' && $id != null) $featuredSql .= " AND t.recid='$id' LIMIT 1";
if (!$featured = mysqli_query($db, $featuredSql)) die(mysqli_error());
var_dump($featured);
if (!$tyre1 = mysqli_fetch_object($featured)) echo "<br />No tyres match those parameters. Please try again.";
$row = mysqli_fetch_array($featured, MYSQLI_NUM);
$read = $row[1];
}
if(isset($\u GET['id'])){
$id=mysqli\u escape\u字符串($db,$\u GET['id']);
$featuredSql=“选择t.*,s.quantity,s.rrp作为nRetailPrice,r.city作为city\u name,ts.thumboil作为tread\u thumboil,ts.bigpic作为tread\u bigpic,t.轮胎评级t.内部连接库存水平s
在t.stockcode=s.stockcode左连接轮胎上,t.treadid=ts.recid左连接经销商r在s.city=r.recid,其中s.quantity>0和s.rrp>0”;
//$featuredResult=mysqli\u查询($db,$featuredSql);
如果($id!='Any'&&$id!=null)$featuredSql.=“和t.recid='$id'限制1”;
如果(!$featured=mysqli_query($db,$featuredSql))死亡(mysqli_error());
var_dump($);
如果(!$tyre1=mysqli\u fetch\u object($featured))回显“
没有与这些参数匹配的轮胎。请重试。”;
$row=mysqli\u fetch\u数组($featured,mysqli\u NUM);
$read=$row[1];
}
我将第一页上的一个表单从使用GET改为使用POST,现在我从服务器收到一个500错误。url看起来像是website.com/tyredeails.php?id=4243,因此正在传递该值
我不知道这为什么不再有效了?在我将原来的搜索区域改为post之前,它工作得很好,但这是分开的,根本没有附加到表单上
编辑**
我刚刚将其他表单的所有更改恢复为post,但它仍然不起作用。我现在认为这不是问题所在
你说你是用post-type做的?密码在哪里?我看不到post类型代码您是否尝试过错误报告(E_ALL);文章内容在页面上的另一个表单上,但这是单独的,在我对更改进行图像处理后,详细信息页面停止工作。post用于获取最初显示产品的信息。
<a href="tyreDetails.php?id=<?php echo $product["recid"]; ?>">