Re: Re: Best way to test for form submission?
| From: | Tom Worster | Date: | Sat, 29 Aug 2009 17:59:58 +0000 |
| Subject: | Re: Re: Best way to test for form submission? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297477@lists.php.net to get a copy of this message | ||
On 8/29/09 9:29 AM, "tedd" <tedd.sperling@gmail.com> wrote:
> At 1:18 AM -0700 8/29/09, Warren Vail wrote:
>> To test a form I usually send the form contents to a php file that contains
>> the following;
>>
>> foreach($_POST as $nm => $val) echo "_POST[".$nm."]
>> [".$val."]<br>";
>> foreach($_GET as $nm => $val) echo "_GET[".$nm."]
>> [".$val."]<br>";
>>
>> Checkboxes and radio buttons only send their value if the control is
>> "checked".
>>
>
> That's correct, here's the way I solve both types:
>
> http://php1.net/b/form-radio
> http://php1.net/b/form-radio1
> http://php1.net/b/form-checkbox/
> http://php1.net/b/form-checkbox1/
warren's test script above doesn't work so well with tedd's scheme for
naming radios & checkboxs. tedd uses name="option[]" in the markup so in
warren's script, when $nm is 'option', $val will be an array so it won't
convert to a string in ".$val.".