1
if($_POST)
{
if(array_key_exists("item_id", $_POST)) // asking if the array exists in data.php,
{
$item_ids = $_POST["item_id"]; // temp var. to hold the data.php data
$price=0;
foreach ($items as $item)
{
foreach($item_ids as $value)
{
if($value==$item['id']) //checking for the ids that were store in array
$price+=$item['price']; // adds price of the ids that are selected
}
}
require_once("view_confirm.php"); //shows the total of price in the view_confirm.php
die();
//if there wasnt any selected boxes its set to true for a statement to be stated on view_items
}
$error_no_items_selected =true;
}
我的函數的工作,我有顯示時沒有點擊框錯誤消息的問題,我將值設置爲false上面的帖子,$error_items_selected
,在我的view_items.php
是HTML代碼,其中我也用:PHP錯誤信息直通控制器,以及PHP
<?php if(error_items_selected==true){echo "Click Something";}
我每次刷新已經出現的信息頁面時
,
'error_items_selected == true'應該是'$ error_items_selected == true' – Pete