Hello,
I am using the SecureNetShop shopping cart for my business. Their final checkout page (thank you page) posts the items as such (for silent posting):
Each item's name, price and quantity are posted in the following format:
item1=name~price~quantity
item2=name~price~quantity
item3=name~price~quantity
and so on...
So if the customer purchases 3 items it would post like this:
item1=Mens Polo Shirt~25.00~2
item2=Ladies Sport Socks~10.00~3
item3=Mens Tie~20.00~1
I am trying to post a row in my DB for each item purchased but I am lost when it comes to arrays or loops 😕
My code below works great as long as the customer only purchases one item. But if they purchase 2 or more items it only inserts the first item instead of all of them.
// Insert all ordered items into items table
list($order_num, $item_name, $item_price, $item_qty) =
split("~", $item1);
mysql_query("INSERT into items
(inv_num, item_name, item_qty, item_price)
VALUES
('$inv_num','$item_name', '$item_qty', '$item_price')");
If I change item1 to item2 it will insert the second item on the list only. If I change it to item3 it will insert only the third product on the list and so on... So I need to get it to insert all items purchased.
If anyone can help me out here I would greatly appreciate it
Thank You
😃