RE: [PHP] downside to passing "[]" characters in URL?

From: Date: Tue, 21 Nov 2000 20:47:10 +0000
Subject: RE: [PHP] downside to passing "[]" characters in URL?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-26523@lists.php.net to get a copy of this message
Monte Ohrt ... > MR wrote: > > > > Well, a thing that i discovered is that PHP doesn't like posted multi-dimensional > > arrays... If you try to post something like > > array[2][6], PHP will do weird things... like as creating $array[2] not as an array, but > > as a standard variable!!! > > > > Believe me, i had to work my way around that problem in order to post two-dimensional > > arrays to a php page... > > > > Did you take a look at wddx? You can serialize and deserialize these > complex data structures, and easily pass them through a URL. No, what i did was rename the variables, put them names with a "-" inside, so the php code can "redo" an array from that crazy variables. I mean: I cannot read well these posted variables: friend[1][name] friend[1][email] friend[2][name] friend[2][email] So i rename them this way around (or similar): friend-1[name] friend-1[email] etc and php, with some tricks and 20 lines of code, passes a strstr all over the HTTP_POST_VARS so it detects the "-" and redoes the array as it should be. I know it's a tricky way, but nobody will see that my code is bad!!!

« previous php.general (#26523) next »