Hi guys, I've been wrestling with this problem for a week now and I'm at the end of my tether.
Basically I've created a shop basket and I'm requesting all the Price and Quantity fields like so $PriceArray = $_REQUEST['Price']; they all have the same ID and have a square bracket containing the unique ProductID which successfully returns the two arrays populated with unique data (example below)...
Array ( [3] => 35 [5] => 60 [4] => 50 [2] => 25 )
The red value is my product ID and the blue is my Price value.
I have the same kind of array for the Quantity fields except the blue value is quantity instead of price.
So I've got two arrays $PriceArray and $QtyArray and from these I'm trying to create a 2D array like this...
array( array("ID" => "3", "Price" => "23", "Qty" => "4"), array("ID" => "4", "Price" => "54", "Qty" => "2"), array("ID" => "6", "Price" => "21", "Qty" => "10") )
I want this array so I can store it in the session easily and then have a confirmation page before inserting the data into the database. The user would also be able to go back and make amendments.
I also found this code on the forum that I thought might be modifiable to do what I want?
function CustomMerge($a, $b)
{
$result = array();
while(($key = each($a)) && ($val = each($b)))
{
$result[$key[1]] = $val[1];
}
return($result);
}
So can some of you clever folk please lend a hand, it'd be much appreciated.