Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 04-09-2005, 12:28 AM   #1 (permalink)
 
Newb Techie

Join Date: Apr 2005

Posts: 10

mulesy

Default Php problems!

Hi,

Im finding php really hard to use and was hoping some one would help me on a few problems.

Ive designed a website a dvd website for a project i had to do
the website it self is completed. i have a buy button after each item but i want it to work out how much the item is and add to it to a sort of cart i aint a clue how to start could anyone help me?

When that one item is ready to buy i want it to confirm as well so it takes it out of a database thats is gonna be a pain as well!

Can anyone help!!

with thanks
Jason
mulesy is offline  
Old 04-09-2005, 01:32 AM   #2 (permalink)
 
Super Techie

Join Date: Mar 2005

Posts: 259

C.Ingram

Send a message via AIM to C.Ingram Send a message via Yahoo to C.Ingram
Default

The most simple approach is to use an array to store items added to the a cart. You can attach the array to a users session.

Code:
$ary_strCartItems = Array(); // Init array
session_start(); // Start session and load data if session exists
if(!session_is_registered('cart')) session_register('cart');
if(isset($_SESSION['cart'])) $ary_strCartItems = $_SESSION['cart']; // Fill cart array if exists.
When someone clicks a link to add to the cart.
Code:
// Use code above plus...
$ary_strCartItems[] = 'Shirt'; // Append an item to the cart
$_SESSION['cart'] = $ary_strCartItems;

__________________
Christopher Ingram
Principal Consultant, Souken Group, LLC.
C.Ingram@SoukenGroup.com
(856) 392 5244 -- (866) Go Souken
C.Ingram is offline  
Old 04-09-2005, 12:44 PM   #3 (permalink)
 
Newb Techie

Join Date: Apr 2005

Posts: 10

mulesy

Default

thanks for that mate, if i have any more problems would it be possible to help me stuggling so badly with this
mulesy is offline  
Old 04-09-2005, 02:17 PM   #4 (permalink)
 
Super Techie

Join Date: Mar 2005

Posts: 259

C.Ingram

Send a message via AIM to C.Ingram Send a message via Yahoo to C.Ingram
Default

Just keep posting here. I'll catch your posts sooner or later.
__________________
Christopher Ingram
Principal Consultant, Souken Group, LLC.
C.Ingram@SoukenGroup.com
(856) 392 5244 -- (866) Go Souken
C.Ingram is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On