Re: $_POST variable

From: Date: Fri, 11 Mar 2011 19:32:34 +0000
Subject: Re: $_POST variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-311775@lists.php.net to get a copy of this message
On Fri, Mar 11, 2011 at 14:28, Danny <dannydebont@gmail.com> wrote: [snip!] > > 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_" ? One method is a foreach() loop. <?php foreach ($_POST as $k => $v) { if (preg_match('/^radio_/Ui',trim($k))) { echo $k.' is a match, and it\'s value is '.$v.'.<br/>'.PHP_EOL; } } ?> -- </Daniel P. Brown> Network Infrastructure Manager http://www.php.net/

« previous php.general (#311775) next »