create a single form using multiple inputs through xml file

condvetither

New Member
here is my problem. I have an xml file that acts like a small database. My php code goes through the xml file and retrieves the info creating a form. For example, the xml file holds info about a menu, the user chooses salad, then the code will print out all types of salads and the user then chooses his favourite salad. The actual problem is that there are different portions; small and large and different prices for each! I am not able to keep track of the selected item... X(Any help??Thanks in advancehere is my code:\[code\]<?phpforeach ($xml-> CATEGORY as $category){ if($_GET['category']==$category["id"]) { echo "<h3>".$category ["id"]."</h3>"; echo "<br />"; echo "<form method=\"post\" action=\"add.php\">"; foreach ($category -> FOOD as $food) { echo "<li>"; echo "<b>".$food["name"]."</b>"; echo "<hr>"; echo "</li>"; echo "<select name=\"variations[]\">"; foreach($food -> PRICE as $price) { echo "<option value=http://stackoverflow.com/"$price\">"; echo "<ul>"; echo $price["size"]. " "; echo $price; echo "</ul>"; echo "</option>"; } echo "</select>"; echo "<input type=\"submit\" value=http://stackoverflow.com/"Buy this\">"; } echo "<br />"; echo "<br />"; } echo "</form>";}?>\[/code\]the cart looks something like this\[code\]<?php echo "<br>"; $values = $_POST['variations']; foreach($values as $value) { echo $value; echo "<br>"; } ?>\[/code\]the code above only shows prices about small items. Large items are somehow ignored!! This code is not actually what I meant to do but it's an start. It should say:You have chosen a large portion of greek salad for
 
Back
Top