different vars with the same name
| From: | Manuel Tejedor Ruiz | Date: | Fri, 01 Dec 2000 09:56:41 +0000 |
| Subject: | different vars with the same name | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28180@lists.php.net to get a copy of this message | ||
hi!
my script receive two vars with the same name but i can only access the
last one. In this example i use the gets method but in fact i must use
the POST method (i thought that my problem would be more easy to explain
with the gets method with my limited english...):
/myscript.php?var1=hello&var1=bye
In ASP i can access both vars this way:
x = Request.QueryString("var1")(1) 'x contains "hello"
y = Request.QueryString("var1")(2) 'y contains "bye"
In PHP i can only get the value of the last var:
1. $x = $HTTP_GET_VARS["var1"]; // $x contains only "bye"
2. $x = $HTTP_GET_VARS["var1"][0]; // $x contains "b"
$x = $HTTP_GET_VARS["var1"][1]; // $x contains "y"
$x = $HTTP_GET_VARS["var1"][2]; // $x contains "e"
any idea?
thanks in advance,
Galfano Carboni