For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > April 2004 > Re: [PHP-DB] more detail..passing array_var with $_get









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] more detail..passing array_var with $_get
Mikhail U. Petrov

2004-04-27, 12:21 am

Hi!
You can't pass array with GET using such method.
For this purpose use
www.main.com?b["foo"]=foo1&b["foofoofoo"]=foo3 etc.

Of course I think you should use urlencode(string);



Monday, April 26, 2004, 1:55:06 PM, Sukanto wrote:

SK> Hi all, sorry for making a little mess up just now..

SK> My problem is I want to pass var array with $_get..

SK> eg : $a=array() then i pass to other pages www.main.com?b=$a
SK> after that echo $b
SK> the result is "array"... just that...

SK> I want to make a product quotation so my purpose is that i add all product 1 by 1 in my local pc
SK> then just adding to database in server at once...

SK> the best way is using array right?? if i using session then it just the same result....

SK> thanx


--
Best regards,
Mikhail U. Petrov
mailto:mikhail@begun.ru
Bent

2004-04-27, 12:21 am

Just make sure that you type $_GET $_SESSION $_POST these variables
are case sensitive. I was stumped for a w because of this problem.

BenT


Sukanto Kho wrote:
> Hi all, sorry for making a little mess up just now..
>
> My problem is I want to pass var array with $_get..
>
> eg : $a=array() then i pass to other pages www.main.com?b=$a
> after that echo $b
> the result is "array"... just that...
>
> I want to make a product quotation so my purpose is that i add all product 1 by 1 in my local pc
> then just adding to database in server at once...
>
> the best way is using array right?? if i using session then it just the same result....
>
> thanx

John W. Holmes

2004-04-27, 12:21 am

From: "Sukanto Kho" <starofflame@hotmail.com>

> My problem is I want to pass var array with $_get..
>
> eg : $a=array() then i pass to other pages www.main.com?b=$a
> after that echo $b
> the result is "array"... just that...


$safe = urlencode(serialize($a));

$url = "http://www.main.com/?b=$safe";

---John Holmes...
Nicole Swan

2004-04-27, 12:21 am

I thought I would mention that if you just "echo" or "print" an array, =
just the word "array" is shown. If you do a var_dump($myArray) on the =
array, the values should be shown. Otherwise you can get the values as =
follows:

$myArray =3D $_GET["b"];

//then get and print values
foreach( $myArray as $num =3D> $val )
{
echo "$val<br />";
//or do whatever with the value -- add to db, etc.
}

--Nicole
---------------------------
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310


-----Original Message-----
From: Sukanto Kho [mailto:starofflame@hotmail.com]
Sent: Monday, April 26, 2004 3:55 AM
To: php-db@lists.php.net
Subject: [PHP-DB] more detail..passing array_var with $_get


Hi all, sorry for making a little mess up just now..

My problem is I want to pass var array with $_get..

eg : $a=3Darray() then i pass to other pages www.main.com?b=3D$a
after that echo $b
the result is "array"... just that...

I want to make a product quotation so my purpose is that i add all =
product 1 by 1 in my local pc=20
then just adding to database in server at once...

the best way is using array right?? if i using session then it just the =
same result....

thanx
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com