Re: $_POST variable

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

 



On Fri, 2011-03-11 at 21:28 +0200, 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
> 

loop thought all the $_POST variables...

foreach($_POST as $key => $val)
{
	if(susbtr($key, 0, 7) === "radio_")
	{
		# this is what we're looking for
	}
}

crude, but works... I am sure there are many ways to look for it.

Steve


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