Added: 2 years ago
From: TheTutSpace
Views: 6,349
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (17)

Sign In or Sign Up now to post a comment!
  • hello.. my problem is when i click add cart its nothing happen it is not adding to my cart.? answer plss.?

  • i keep getting Notice: Undefined index: quantity- in C:\xampp\htdocs\CART\cart.php on line 9

    my code around line 9 is: if($_POST['quantity-'.$key] == 0){ unset($_SESSION['cart'][$key])­; } else { $_SESSION['cart'][$key]['quant­ity'] = $value; }

    any ideas? its really bugging me. everything still works fine, just get a notice up. thanks!

  • @sandeepshah89 to get rid of the Undefined Index you can use the function isset() within the if() statement. Eg. if(isset($_POST['...'])) blah blah.

    Alternatively, there is nothing wrong with just hiding Notice errors, so in your php.ini file, you can edit the error_reporting section to say E_ALL ~ E_NOTICE

  • @TheTutSpace did it!

    put if(isset($_POST['quantity-'.$k­ey])){ just outside the if statement if($_POST['quantity-'.$key] == 0){. error message gone, tested the website and all is functional.

    just wanted to thank you for this tutorial, gonna add new features and stuff, but it was a great learning curve. thanks

  • @sandeepshah89 You can get rid of the :

    $key = explode("submit",$key);

    $key = end($key);

    and replace it with:

    if($key == "submit") { unset($_SESSION['cart'][$key])­;

    }

    change the next if to an else if

  • error Notice: Undefined variable: _SESSION in C: \ xampp \ htdocs \ a\ cart.php on line 31

    Warning: Invalid argument Supplied for foreach () in C: \ xampp \ htdocs \ a\ cart.php on line 31

    Why?

  • @Kyrakuum Email me your code and I will see what i can do, but to my it looks like you may have not started the session (use session_start() at the top of the page)

  • @TheTutSpace is true! I don't use session_start() sorry! thanks for answer

  • dear sir u are missing the starting of cart.php plz give me starting cart.php toturial...!!! the is main toturial starting cart.php

  • dear sir u are missing the starting of cart.php plz give me starting cart.php toturial...!!!

  • Thanks , it provides a great insight to the various features of php , also a

    harbinger of technology becoming more and more humanfriendly.

  • Thanks Tiger :)

  • seemed pointless being in the group, Where no views were obtained :)

  • 5* + fav.. btw why did u leave php4eva ? im sad -.-

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more