I am having a hard time trying to create a form using php that takes information from a multi-dimensional array(database isn't allowed for this assignment) to create the shopping cart feature like on ebay or amazon. The user is only supposed to be able to select one item to purchase, then pass the information to the next form in the process. I am trying to re-create a feature that I did in VB.net, using a nested loop to generate the repetitive controls for the form, in this case radio buttons.
<?php
$itemNumber = 0;
foreach( $items as $item ) {
$itemNumber++;
echo "<tr height=80px>";
//i think the problem is in the nested loop below//
foreach( $item as $key => $value ){
$myThumbnail = generateThumbnail("$itemNumber".".jpg");
echo "<td width = 50%><input type="radio" name="itemName" id="$itemNumber" value="itemName" setChecked("itemName", "itemName") /></td>";
echo "<td width=50%>$myThumbnail</td>";
}
echo "</tr>";
}
?>
I have ran my code through a syntax checker but the checker is very limited. I have tried for going on six days now to find my errors. My instructor for this class hasn't returned any emails. I have searched both stackoverflow and PHPfreaks for possible solutions but all options I found use databases and/or hard code all the controls instead of creating them dynamically so as to make as many as needed no matter how big or small the array is. If more code is needed I will add upon request.