View Single Post
Old 12-27-2012, 06:53 PM   PM User | #1
nepoverljiv
New Coder

 
Join Date: Mar 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
nepoverljiv is an unknown quantity at this point
Question Php Array And Listing Description From Table

Hi,

I make some code and almost finish my shopping cart on website. Just need finally touch .

Ok, I have problem on last page, problem is like this. When someone click to order what he putted in shopping cart, on one page I wanna list everything what he ordered an send on e-mail. Trick is I don't have only id in array, I have almost quantity. For example, if someone order article with id=1 and quantity 3, and article with id=2 and quantity 4, and article with id=3 and quantity 2. On my page I get all that in array like this:

PHP Code:
$array=$_POST['id']; 
When I print that I get this:

1-3,2-4,3-2

How to I get from my table "description", list of every article in this example and immediately multiply them price with quantity?

I try something with:

PHP Code:
$id_quantity_pair explode("-"$array); // Uses Hyphen(-) as delimiter to separate product ID from its quantity
        
$product_id $id_quantity_pair[0]; // Get the product ID
        
$product_quantity $id_quantity_pair[1]; 
But I dont know how to put that in list, I know only to working with array with one value.

Anyone to help me?
nepoverljiv is offline   Reply With Quote