Re: Re: [PHP-DB] Re: radio form submission

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



#### 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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux