I'm further down the line with my code than I was the last time I posted, but I've encountered another problem. My FOR loop doesn't appear to execute unless I add a numerical value as the condition (as opposed to a variable).
Example:
extract($_POST, EXTR_PREFIX_SAME, "myVar");
// $expectedItems is created, with a value of 8
for($i=0; $i<$expectedItems; $i++){
$varName1 = "itemIdArray" . $i;
$varName2 = "itemCatArray" . $i;
$varName3 = "itemTitleArray" . $i;
$varName4 = "itemDescArray" . $i;
$varName5 = "itemLocationArray" . $i;
$varName6 = "itemImgArray" . $i;
// Do some stuff with these variables
}
If I swap $expecteItems for the value '10' in the loop conidtion, the loop runs 10 times, as would be expected. So why doesn't it work with the variable, which clearly has a value of '8'??? I'm thinking this must be a problem with the typing of the variable, but I though variables in PHP weren't strictly typed?
I'm nearly there, and any help would be gratefully received!