For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > April 2004 > passing var array









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 passing var array
Sukanto Kho

2004-04-27, 12:21 am

Hi,

How to pass var array to other page?

I use $_GET but when I echo it, it appear "array"...

Thanx

Sk2
Pete M

2004-04-27, 12:21 am

http://localhost/index.php?val_one=one&val2=2

on index.php
print_r($_GET) will show the array

echo "val l=".$_GET['val_one'];
echo "val 2=".$_GET['val2'];

its CAse senSitivE

you can also do a
foreach($_GET as $k => $v)
{
echo $k."=".$v;
}


Sukanto Kho wrote:
> Hi,
>
> How to pass var array to other page?
>
> I use $_GET but when I echo it, it appear "array"...
>
> Thanx
>
> Sk2

Andy Ladouceur

2004-04-27, 12:21 am

You can pass arrays via GET using the syntax:

http://localhost/index.php?val[1]=one&val[2]=2&...val[key]=value

Andy

Pete M wrote:[color=darkred]
> http://localhost/index.php?val_one=one&val2=2
>
> on index.php
> print_r($_GET) will show the array
>
> echo "val l=".$_GET['val_one'];
> echo "val 2=".$_GET['val2'];
>
> its CAse senSitivE
>
> you can also do a
> foreach($_GET as $k => $v)
> {
> echo $k."=".$v;
> }
>
>
> Sukanto Kho wrote:
>
Sponsored Links







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

Copyright 2008 codecomments.com