create a single form using multiple inputs through xml file
<p>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! </p>

<p>I am not able to keep track of the selected item... X(</p>

<p>Any help??</p>

<h2>Thanks in advance</h2>

<p>here is my code:</p>

<pre><code>&lt;?php
foreach ($xml-&gt; CATEGORY as $category)
{
  if($_GET['category']==$category["id"])
  {
    echo "&lt;h3&gt;".$category ["id"]."&lt;/h3&gt;";
    echo "&lt;br /&gt;";
    echo "&lt;form method=\"post\" action=\"add.php\"&gt;";
    foreach ($category -&gt; FOOD as $food)       {
      echo "&lt;li&gt;";
      echo "&lt;b&gt;".$food["name"]."&lt;/b&gt;";
      echo "&lt;hr&gt;";
      echo "&lt;/li&gt;";
      echo "&lt;select name=\"variations[]\"&gt;";
      foreach($food -&gt; PRICE as $price)
      {
        echo "&lt;option value=\"$price\"&gt;";
        echo "&lt;ul&gt;";
        echo $price["size"]. " ";
        echo $price;
        echo "&lt;/ul&gt;";
        echo "&lt;/option&gt;";
      }
      echo "&lt;/select&gt;";
      echo "&lt;input type=\"submit\" value=\"Buy this\"&gt;";
    }
    echo "&lt;br /&gt;";
    echo "&lt;br /&gt;";
  }
  echo "&lt;/form&gt;";
}

?&gt;
</code></pre>

<p>the cart looks something like this</p>

<pre><code>&lt;?php 
  echo "&lt;br&gt;";
  $values = $_POST['variations'];           
  foreach($values as $value)
  {
    echo $value;
    echo "&lt;br&gt;";            
  } 
?&gt;
</code></pre>

<p>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:</p>

<p>You have chosen a large portion of greek salad for £10.50.
So, I should be able to pass three variables that I don't know how: $price[size], food and $price...</p>

<p>Thanks for your time</p>
