#### radio select validation ####

What I am doing wrong?

I want to make sure a radio button is selected, but my current code
allows insertion even when radio button isn't selected.

My code is:

                                //Generating radio buttons for store type with 
array
                                echo 'Store type:<br /><br />';
                                        $choices = array('corporate' => 
'Cricket owned | ',
                                                                         
'premier' => 'Premier dealer');
                                                                         
foreach ($choices as $key => $choice) {
                                                                                
 echo "<input type='radio' name='store_type' value='$key'/>
$choice \n";
                                                                        }
                                //Validate the radio button submission
                                                                        if 
(!array_key_exists($_POST['store_type'], $choices)) {
                                                                            
echo "You must select a valid choice.";
                                                                        }


Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to