Re: [PHP] POST-ing or GET-ing an array

2002-10-30 Thread rija
Why don't you launch your script once you are in the next page?
like:
"next"

So you don't have to get or post anything?

$sql = "select stuff from my_table";
$result = mysql_query($sql);
$count = 0;
 
while ($myrow = mysql_fetch_assoc($result)) {
$id = $myrow["id"];
$my_array[] = $id;
}

- Original Message - 
From: "Petre Agenbag" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 30, 2002 4:40 AM
Subject: [PHP] POST-ing or GET-ing an array


> 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:
> 
> Next
> 
> BUT, that obviously doesn't work...
> 
> Please just help me out, I'm suffering...
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



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




RE: [PHP] POST-ing or GET-ing an array

2002-10-30 Thread Ford, Mike [LSS]
> -Original Message-
> From: Paul Nicholson [mailto:paul@;dtnicholson.com]
> Sent: 29 October 2002 19:10
> To: Sascha Cunz; Petre Agenbag; [EMAIL PROTECTED]
> 
> 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 'Next';
> You'll need to unserialize+urldecode the array at the other end.

You shouldn't need to urldecode(), as this happens automatically.  In fact, this is 
exactly *why* you need to urlencode() it in the first place!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




Re: [PHP] POST-ing or GET-ing an array

2002-10-29 Thread Sascha Cunz
> 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 'Next'; You'll need to unserialize+urldecode the array at the other
> end.

This is way nicer :-)

Sascha

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




Re: [PHP] POST-ing or GET-ing an array

2002-10-29 Thread Paul Nicholson
-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 'Next';
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:
>
> 
>
> 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:
> >
> > Next
> >
> > BUT, that obviously doesn't work...
> >
> > Please just help me out, I'm suffering...

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
"The webthe 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




Re: [PHP] POST-ing or GET-ing an array

2002-10-29 Thread Kevin Stone
Checkout serialize(); and unserialize();
http://www.php.net/manual/en/function.serialize.php
http://www.php.net/manual/en/function.unserialize.php

//On your first page..
$myarray = serialize($myarray);
echo "Link";

//Then on your other page..
$myarray = unserialize($_GET['myarray']);
print_r($myarray);
-Kevin


- Original Message - 
From: "Petre Agenbag" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 29, 2002 10:40 AM
Subject: [PHP] POST-ing or GET-ing an array


> 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:
> 
> Next
> 
> BUT, that obviously doesn't work...
> 
> Please just help me out, I'm suffering...
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



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




Re: [PHP] POST-ing or GET-ing an array

2002-10-29 Thread Petre Agenbag
Oops, I forgot to add the $count++ at the end of the while loop, but
that was just an ommission of this post, in my real code, the array is
created fine ( tested it with a print_r($my_array) ).


On Tue, 2002-10-29 at 19:40, Petre Agenbag wrote:
> 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:
> 
> Next
> 
> BUT, that obviously doesn't work...
> 
> Please just help me out, I'm suffering...
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] POST-ing or GET-ing an array

2002-10-29 Thread Sascha Cunz
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:



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:
>
> Next
>
> BUT, that obviously doesn't work...
>
> Please just help me out, I'm suffering...


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




[PHP] POST-ing or GET-ing an array

2002-10-29 Thread 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:

Next

BUT, that obviously doesn't work...

Please just help me out, I'm suffering...




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