Ok, long story short: I am trying to place items in an array sorted by a value as part of an object(the object defined as $aProductOrdered and the public value:productMan). The post will be variable depending on items added and removed from a database so it has to be dynamic.
For example if the index is 12 for a certain productMan value all items with that would be in one row like:
[12][0]:prodObj [12][1]:prodObj
[15][0]:prodObj
[22][0]:prodObj [22][1]:prodObj
where the first is the prodMan value from the object and the second is an arbitrary auto assigned index to loop through representing each object.
Below is what I have but when I go to insert into the array, it accurately says the index I am trying to add to is undefined. How may I add the index if it doesn’t exist or if it does just append to it?
$vendOrderArray = array(array());
//here we will loop through all non blank posted orders and create objects to place them in our $orderArray
foreach($_POST as $prodID=>$numOrderded)
{
if(is_numeric($numOrderded) && $numOrderded != "" && $numOrderded != "0")
{
$aProductOrdered = getProduct($prodId);
$aProductOrdered->numberOrdered = $numOrderded;
array_push($vendOrderArray[$aProductOrdered->productMan],$aProductOrdered);
}
}
Just before the
array_pushcall.