Re: different vars with the same name
| From: | Daniel Convissor | Date: | Fri, 01 Dec 2000 16:03:38 +0000 |
| Subject: | Re: different vars with the same name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28215@lists.php.net to get a copy of this message | ||
Hi Manuel:
> my script receive two vars with the same name but i can only access the
> last one.
That's because you can't. A variable can only hold one value. Otherwise,
how does PHP know which you mean? The ASP example you gave us, in essence,
creates an array out of the two variables with the same name. If you want to
make an array, you can do this:
NO: /myscript.php?var1=hello&var1=bye
YES: /myscript.php?var1[0]=hello&var1[1]=bye
That's the best you can do.
Enjoy,
--Dan
--
PHP scripts that make your job easier
http://www.analysisandsolutions.com/code/
SQL Solution | Layout Solution | Form Solution
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409