Skip to content Skip to sidebar Skip to footer

How Can I Write An Array That Holds Multiple Values For Each Product

I've been searching around php.net, w3schools and youtube for something that has multiple objects like 'move1, movie2' where each of those objects has variables like 'id, qty, pric

Solution 1:

you can handle this in php (server side) which is more common, and also you can handle in client side with java-script which i do'nt recommand . you can use key-value arrays in php, for example you can easily do as bellow:

$basket[0]['productName']='Movies1';
$basket[0]['qty']=1;
$basket[0]['price']=15;
$basket[1]['productName']='Movies2';
$basket[1]['qty']=2;
$basket[1]['price']=30;

in this way you will have an array which can hold all off required information about your products.

Post a Comment for "How Can I Write An Array That Holds Multiple Values For Each Product"