Re: Re: $_POST variable
| From: | richard gray | Date: | Fri, 11 Mar 2011 20:18:53 +0000 |
| Subject: | Re: Re: $_POST variable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311783@lists.php.net to get a copy of this message | ||
You could use foreach to iterate through the post variables until you
encounter a match:
foreach ($_POST as $key => $value){
if (substr($key, 0, 6) == "radio_") {
$buttonName = $key;
$buttonValue = 4value;
break 2;
}
}
I haven't tried the above code, but I hope someone will correct my
efforts if I'm wrong.
given your code example -> 'break 2;' -- s/b just 'break;' ... 'break 2;' is to exit the outer loop of a nested loop which is not the case here.
Rich