<input type="checkbox" name="chkItems[]" value="120">Mask<br>
<input type="checkbox" name="chkItems[]" value="120">Assault Vest<br>
<input type="checkbox" name="chkItems[]" value="300">Combat Pistol<br>
<input type="checkbox" name="chkItems[]" value="80">Paintball Hopper<br>
<input type="checkbox" name="chkItems[]" value="75">Case of 2000 Paintballs
<?php
# set variables
$items = $_GET["chkItems"];
$message = "";
if(isset($_GET["chkItems"]))
{
foreach ($items as $i)
{
echo $i. "<br />";
}
}else{
$message .= "<b>Error</b>: No items were selected.";
}
?>
Before performing any calculations ensure on the server-side that at least one item was checked. If no items were selected, output an error message; otherwise, you can begin the totaling and output process.
I get this error: Notice: Undefined index: chkItems in C:\xampp\htdocs\PHPCookiesPractice\serverCode\calcTotal.php on line 4
and only if none of the checkboxes are checked.