当我提出这个问题时,我的标题出现了问题:
<a href='?p=Winkelmand&BID=".$row['BID']."&ProductID=".$row['ProductID']."&Actie=Vermeerderen'><span class='glyphicon glyphicon-plus'></span></a>
在我的代码中,当我向购物车添加内容时,它开始给我错误...
这是警告:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\Snackbar\Design\Pages\Head.php:117) in C:\xampp\htdocs\Snackbar\System\Pages\Winkelmand.php on line 81
Head.php第117行:
print("<td><a href='?p=Winkelmand&BID=".$row['BID']."&ProductID=".$row['ProductID']."&Actie=Vermeerderen'><span class='glyphicon glyphicon-plus'></span></a> ".$row['Aantal']);
Winkelmand.php第81行:
header("Location: ?p=Producten");
奇怪的是当我删除它然后它工作正常并将我发送到我请求的标题页面...
提前致谢
答案 0 :(得分:1)
在更改标题之前,您必须确保无法容忍输出 注意,警告和错误也是输出:)
基本上你的问题是你在$row
数组中加入了未定义的索引
我建议你至少做这样的检查
<?php
$bid = empty($row['BID']) ? '' : $row['BID'] ;
$productId = empty($row['ProductID']) ? '' : $row['ProductID'];
$antal = empty($row['Aantal']) ? '' : $row['Aantal'] ;
print("<td><a href='?p=Winkelmand&BID=".$bid."&ProductID=".$productId."&Actie=Vermeerderen'><span class='glyphicon glyphicon-plus'></span></a> ".$antal);
?>