The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Notice: Undefined index: chkItems on line 4 (php)

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #164728
    Attila Hajzer
    <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
    # set variables 
    $items = $_GET["chkItems"];
    $message = "";
        foreach ($items as $i)
            echo $i. "<br />";
        $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.

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.