if I receive value from $_GET, can i POST it back to...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

if I receive value from $_GET, can i POST it back to...

Post by voltrader »

if I receive variable from $_GET, can i POST it back to same php page for further processing?

1) I send ?ref=1 to page 2

2) display some stuff based on $_GET['ref'] in page 2

3) on submission of form back to page 2 for processing, I seem to lose $_GET['ref']
I thought I could make it persistant to the page by making it an INPUT TYPE=hidden variable in HTML, but that didn't work.

What am I missing here?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

when posting back, $_GET['ref'] won't exist, unless you passed ref through the action's url.
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

Post by voltrader »

I think I understand now. I should echo the hidden variable value from within the script so that it becomes part of page 2. Thanks.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

or use a session or cookie
Post Reply