#7934 [Csd]: HTTP_POST_VARS unable to handle same key multiple times
| From: | rasmus@php.net | Date: | Thu, 05 Sep 2002 22:25:02 +0000 |
| Subject: | #7934 [Csd]: HTTP_POST_VARS unable to handle same key multiple times | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18547@lists.php.net to get a copy of this message | ||
ID: 7934
Updated by: rasmus@php.net
Reported By: bzeeb+php@zabbadoz.net
Status: Closed
Bug Type: Variables related
Operating System: FreeBSD
PHP Version: 4.0.3
New Comment:
Every JS element has a numerical index number. You do not have to use
the name at all which allows you to call things whatever you want.
Previous Comments:
------------------------------------------------------------------------
[2002-09-05 16:59:05] dyonn@sympatico.ca
Correct me if I'm wrong, but I actually think this is a bug because
adding [] to the NAME of the checkbox makes the object to be
unaccessible throught javascript(or really hard to access).
document.myform.mycheckbox[].lenght will give syntax error.
I browsed quite a lot on the net and I havent found the way to play
with a JS variable named something[]
------------------------------------------------------------------------
[2002-07-30 11:52:21] hholzgra@php.net
to chrisrivera@chrisrivera.com:
by giving the [] you specify that you *want*
an array while creating one auto-magicaly
whenever multiple values exists may confuse
form processing code as input variables may
be string or array depending on number of
selections made
to olivierdsm@hotmail.com:
this will do the trick for you:
"... IN (".join(",",$inmailtoupdate).") "
(but make sure $inmailtoupdate is not empty() before you do so)
please direct further questions to the php-general mailing list as we
are no longer talking about bugs here
------------------------------------------------------------------------
[2002-07-30 09:31:51] olivierdsm@hotmail.com
This is what i codded :
<input type="checkbox" name="inmailtoupdate[]" value="<? echo
$row['admins_id']; ?>">
then :
$SQL = "update admins set admins_inmail='yes' where admins_id in
($inmailtoupdate)";
--> this is what i get as error message : "Unknown column 'Array' in
'where clause'
so, ok i can write something like echo inmailtoupdate[1], but how do i
get the complette list???
------------------------------------------------------------------------
[2002-07-18 09:52:34] chrisrivera@chrisrivera.com
Why is it that the '[]' is needed in the name attribute? Isn't this
considered a bug then? Looping through the vars should return that it
is an Array by default without the need of adding '[]' to the name
attribute. This seems to be more of a hack than a solution.
------------------------------------------------------------------------
[2000-11-23 05:25:33] sniper@php.net
Just add [] to the name. i.e.
<input type="checkbox" name="FORM_key[]" value="2">
--Jani
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/7934
--
Edit this bug report at http://bugs.php.net/?id=7934&edit=1