-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,
I think you should be able to serialize and urlencode the array and then
pass that via get/post.....post would be a lot better as get is limited to so many 
chars.
Something like:
$sql = "select stuff from my_table";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_assoc($result)) {
      $id = $myrow["id"];
      $my_array[] = $id;
}
echo '<a href="next_page.php?array='. urlencode(serialize($my_array)) .'">Next</a>';
You'll need to unserialize+urldecode the array at the other end.
And yes, $count is not needed if you use $my_array[].
HTH!
~Paul

On Tuesday 29 October 2002 12:56 pm, Sascha Cunz wrote:
> Hi,
>
> first of all, i would prefer to do this task in a session-variable (less
> traffic, less security holes).
>
> But, if you're sure you need to pass the array via an URL, try:
>
> <A HREF="test.php?ary[]=1&ary[]=2">
>
> which will result in test.php called with $_GET['ary'] containing:
>
> [0] = '1'
> [1] = '2'
>
> If the array contains strings (as databases usualy do), you should
> url-encode them.
>
> If there is a better way to do this task, please let me know too.
>
> - Sascha
>
> Am Dienstag, 29. Oktober 2002 18:40 schrieb Petre Agenbag:
> > Hi
> > I KNOW I'm gonna get flamed, but I can't find this anywhere in my books
> > or in the manual, yet I know I've read it somewhere.
> >
> > I created an array in a loop as such:
> >
> > $sql = "select stuff from my_table";
> > $result = mysql_query($sql);
> > $count = 0;
> >
> > while ($myrow = mysql_fetch_assoc($result)) {
> >     $id = $myrow["id"];
> >     $my_array[$count] = $id;
> > }
> >
> >
> > Now, I want to send that array to another page with a normal:
> >
> > <a href="next_page.php?array=$my_array">Next</a>
> >
> > BUT, that obviously doesn't work...
> >
> > Please just help me out, I'm suffering...

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
"The web....the way you want it!"
[EMAIL PROTECTED]

"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9vtzwDyXNIUN3+UQRAmOuAKCcK9Tsu/iO/wgwbL+HL6U7aqRkjQCePTF8
sgGAtUCCe5K+dlw6ljcJFzY=
=+BC1
-----END PGP SIGNATURE-----

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to