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;
}
My function works, I have a problem displaying an error message when the there is no click boxes, I set the value to false above post, $error_items_selected, on my view_items.php is HTML code, where I also use:
<?php if(error_items_selected==true){echo "Click Something";}
every time I refresh the page the message already appears,
error_items_selected == trueshould be$error_items_selected == true