Re: Re: Best way to test for form submission?

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

 



On 8/29/09 9:29 AM, "tedd" <tedd.sperling@xxxxxxxxx> 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.".



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