I understand there are many posts on this issue. I have looked at the many many posts but for some reason I can seem to find an answer!
Any help will be very much appreciated. I am fairly new to PHP so I apologise if I say anything incorrectly.
I am trying to create a basic basket system using an array. I keep getting an error undefined index on line $_SESSION['cart'][$app_ID]++; The funny thing is it all functions correctly! I want to solve the error and not just turn off the error reporting.
    if(isset($_GET['id'])){
$app_ID = $_GET['id'];   //the item id from the URL 
$action = $_GET['action']; //the action from the URL 
$total = 0;
if (isset($app_ID)){
switch($action) {       
    case "add":
        $_SESSION['cart'][$app_ID]++;
    break;
    case "remove":
        $_SESSION['cart'][$app_ID]--; 
        if($_SESSION['cart'][$app_ID] == 0) unset($_SESSION['cart'][$app_ID]); 
    break;
    case "empty":
        unset($_SESSION['cart']); //unset the whole cart, i.e. empty the cart. 
    break;
Thanks guys and gals.
 
     
     
     
     
    