Hi !
I’m new to php and try to devellop a simple application that would allow the user to classify various dishes by using radio buttons. I'm a bit lost :(

My code is as follows (I’ve already got help to achieve it, but can’t go further). The first part is correct. But the second one, which consists in showing the dishes in the corresponding section (eg:

  • ,

  • Slat:
  • ,

  • Spicy :
  • ), do not work.
  • Thank you very much for your help!!

  • Raf

$dish = array('soup', 'starter', 'meal', 'dessert');

echo '<form action="" method="post">

foreach ($dish as $value){
echo '<tr>
  <td><input type="radio" value="sugar" name="dish['.$value.'][]" /></td>
  <td><input type="radio" value="salt" name="dish['.$value.'][]" /></td>
  <td><input type="radio" value="spicy" name=dish['.$value.'][]" /></td>
echo '<tr><td colspan="4"><input type="submit" name="env" value="submit" /></td></tr></table></form>';


<strong> Sugar : </strong>

<?php /* From this point it doesn’t work any more*/
foreach($_POST['dish'] as $selection)
    echo($selection == "sugar") $value ;

can u plz tell, what output do u expect?

Hi! I expect it
1) to show a form that allows the user, for each element of the array (the dishes), to choose between sugar, salt or spicy
2) to show, under three static subtitles (wich are once again sugar, salt or spicy), wich dishes has been selected for each value

so the html form would be (this part is ok)

dishes | sugar | salt | spicy
soup | [radio] | [radio] | [radio]
starter|[radio] | [radio] | [radio]
meal | [radio] | [radio] | [radio]
dessert| [radio] | [radio] | [radio]

if the user would select soup: salt, starter, spicy, meal: spicy and dessert sugar, the output would be:
Sugar: dessert
Salt: soup
Spicy: starter, meal
This part does not work...

Thank you very much!!!