<?php $choices = array('eggs' => 'E', 'toast' => 'T', 'coffee' => 'C'); foreach ($choices as $key => $choice) { echo "<input type='radio' name='food' value='$key'/> $choice \n"; } if (! array_key_exists($_POST['food'], $choices)) { echo "You must select a valid choice."; } ?>