PHP & MySQL - Shopping Cart - Part 12

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
6,351
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Feb 5, 2010

I think this is the last tutorial


Thanks for following this series, and please email me at alex_ishere@hotmail.co.uk for more ideas for tutorials, and i might give them a shot :D

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (TheTutSpace)

  • 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

  • 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)

  • Thanks Tiger :)

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

see all

All Comments (17)

Sign In or Sign Up now to post a comment!
  • @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

  • hello.. my problem is when i click add cart its nothing happen it is not adding to my cart.? answer plss.?

  • @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

  • @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...!!!

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