|
-
Jun 27th, 2004, 12:11 AM
#1
Thread Starter
Stuck in the 80s
[Resolved] Pass PHP Array in the URL?
I'm calling a page like this: http://localhost/test.php?a[]=a&a[]=b&a[]=c&a[]=d&a[]=e&a[]=f&a[]=g&a[]=h&a[]=i
And using this code:
PHP Code:
<?php
if (isset($_REQUEST['a'])) {
if (is_array($_REQUEST['a'])) {
for ($i = 0; $i < count($_REQUEST['a']); $i++) {
echo $_REQUEST['a'][$i] . '<br />';
}
}
}
?>
It works perfectly, but I'm wondering if there are any drawbacks to it?
I've never seen anything do it this way before, so it makes me paranoid that there's something wrong with doing it that way.
Last edited by The Hobo; Jul 13th, 2004 at 12:56 PM.
-
Jul 13th, 2004, 04:27 AM
#2
Retired VBF Adm1nistrator
Only thing I can think of, is, is there a maximum length for a querystring?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 13th, 2004, 06:58 AM
#3
Nothing wrong, it's a feature of PHP.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 13th, 2004, 12:56 PM
#4
Thread Starter
Stuck in the 80s
-
Jul 14th, 2004, 05:17 AM
#5
Retired VBF Adm1nistrator
Would it not make more sense to pass complicated data like that by POST instead of GET?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|