On 03/11/2011 01:28 PM, Danny wrote:
> Hi guys,
> 
> I have a form that has a long list of radio-bottons inside of it. The
> radio-buttons are dynamically created via php and MySQL.
> 
> Here is an example of one of the radio buttons:
> 
> <input type="radio" name="<?php print ("radio_".$result_from_mysql) ; ?>" 
> value="0">
> <input type="radio" name="<?php print ("radio_".$result_from_mysql) ; ?>" 
> value="1">
> 
> Now, when I submit this form to another page for processing, how would I 
> "catch"
> the above radio-button's $_POST name since I do not know the name, only that 
> it
> starts with "radio_" ?
> 
> Thank You
> 
> Danny

The most common and flexible way to do this sort of thing is to use
arrays instead:

<input type="radio" name="radio[<?php echo $result_from_mysql; ?>]"
value="0">
<input type="radio" name="radio[<?php echo $result_from_mysql; ?>]"
value="1">


Then:

foreach($_POST['radio'] as $key => $value) {
   echo "radio for $key is $value";
}
-- 
Thanks!
-Shawn
http://www.spidean.com

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

Reply via email to