Re: POST-ing or GET-ing an array

From: Date: Tue, 29 Oct 2002 17:56:13 +0000
Subject: Re: POST-ing or GET-ing an array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-121913@lists.php.net to get a copy of this message
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...

« previous php.general (#121913) next »