Re: [PHP] Q: How to get the value of a checkbox of which name without '[]'?

2003-08-18 Thread CPT John W. Holmes
- Original Message - 
From: "Frode" <[EMAIL PROTECTED]>
[...snip...]
Which means I can't modify the code above into PHP prefered
style:





[...snip...]

> Why is this the preferred style, and where can I read more about it?

I don't know about preferred style or not, but if you want PHP to recognize
multiple values from a form or URL, then you must add the [] onto the name
so PHP will put it into an array. Otherwise you end up with
"box=1&box=2&box=3" and when PHP parses that, each overwrites the other, so
you end up with $box == 3 at the end and the other values are lost. I'm sure
it's discussed in the Form Handling section of the manual.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Q: How to get the value of a checkbox of which name without '[]'?

2003-08-18 Thread Frode
 
[...snip...]
Which means I can't modify the code above into PHP prefered
style:
 



 
[...snip...]

Why is this the preferred style, and where can I read more about it?

Frode Lillerud, Norway

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Q: How to get the value of a checkbox of which name without '[]'?

2003-08-18 Thread CPT John W. Holmes
> Consider the following form in a HTML file:

>

> ...

> 

> 

> 

> 

> ...

>

> Now I'm posting this form into a PHP script.  The problem is I can't
change

> that HTML file.  Which means I can't modify the code above into PHP
prefered

> style:

>

> 

> 

> ...

>

> So, how can I get the correct values of the checkbox?  $_REQUEST['box'] is

> not an array and only contains the last value.  Thanks!



Parse the value of $_SERVER['QUERY_STRING'] yourself and make the array.



---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php