My second question about PHP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

My second question about PHP

Postby eyewoo » Tue Mar 11, 2003 2:02 pm

I'm passing variables in an <a href=filename?vab1=$vab2&vab2=$vab2&ray=$ray>click</a> construction. The variables pass fine, but the "ray" which is an array does not. How do you pass an array along with a url after the "?"

Can't seem to find anything about it in my book on PHP.

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

Postby Xerpher » Tue Mar 11, 2003 3:15 pm

Personally, I didn't think you could... as far as I know you'd have to use a foreach loop to put each array child in its own $_GET variable

eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

Postby eyewoo » Tue Mar 11, 2003 4:41 pm

That's to bad...

My solution, which might not be the best, but it seems to work. I implode it, send it, and then explode it on the other side.

rich81
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Mar 04, 2003 3:45 pm

Postby rich81 » Tue Mar 11, 2003 5:50 pm

you could pass it as a $_SESSION[] variable.... set it on one side, pass all the other regular variables through *.php?a=b etc, then retrieve it on the other side and unset the $_SESSION[] variable you created after grabbing the array out.

eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

Postby eyewoo » Tue Mar 11, 2003 7:09 pm

I'm really new to PHP... don't know about $_SESSION[] variables yet... Sounds like a global variable??? I'll have to look into it... Thanks.

eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

Postby eyewoo » Thu Mar 13, 2003 11:26 am

Solved it in quite a different way so that I don't have to pass the array at all. I'm now using one file with a switch statement. The file calls itself with different values for the switch. Each switch/case in the file is a different page display that uses information from an array in an init section at the head of the file. ....so, several pages from one file with no need to pass arrays between files. Interesting.... cool stuff, this PHP 8)


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests