Hey All.
Somewhat new to php, so excuse the simple question.
Currently, I have a 'register_game.php' that takes form data and submits via get method to a tfmail script. All this is working fine.
I need to add in some validation to check that user data on the form is valid existing user. So, I have added a 'check_user.php' that hits the database, and checks that the user exists. This is working fine as well. What I'm having trouble with is after the check...
So, what I have now is:
The 'register_game.php' page that takes form data and submits to a 'check_name.php' page.
'check_name.php' then validates information and will either:
- continue on and redirect to 'tfmail' script
- return user back to 'register_game.php
The problem I'm having is redirecting to tfmail script or back to the 'register_game.php'. The REQUEST attributes are no longer in the request. What is the best way to "re-insert" the request data so that when I redirect with a header( 'Location:xxx) function from the 'check_name.php' to the other pages, the data from the form submitted by the original submit in the 'register_game.php' will continue on to the pages I redirect to.
Hope this makes sense. Any input or advice would be appreciated.
PHP Redirect and maintain Request Parameters - Advice Needed
Moderator: General Moderators
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: PHP Redirect and maintain Request Parameters - Advice Needed
use cookies or sessions. passing data as a "request" is as simple as appending data & value pairs to the URI
http://www.daedalus.com/?artist=the%20jacka&comment="is so sick"
http://www.daedalus.com/?artist=the%20jacka&comment="is so sick"
Re: PHP Redirect and maintain Request Parameters - Advice Needed
Hey daedalus__
Thanks for the reply.
I realize that passing data as request is appending the data/value pairs to URI. It just seemed kinda messy to have to recreate the whole URI by appending all attributes (there are only about 8 of them, but still).
So, if I used sessions, how would that work, or do I need to pass data via request to the tfmail script?
Thanks for your help.
Thanks for the reply.
I realize that passing data as request is appending the data/value pairs to URI. It just seemed kinda messy to have to recreate the whole URI by appending all attributes (there are only about 8 of them, but still).
So, if I used sessions, how would that work, or do I need to pass data via request to the tfmail script?
Thanks for your help.
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: PHP Redirect and maintain Request Parameters - Advice Needed
there are session functions and a superglobal array to store the variables in called $_SESSION.
i think there is a function for building URI's from arrays or you could write one yourself. but if you want to use requests thats the way you have to do it.
however, if you are creating an authorization system the preferred method is through the use of sessions w/ a database.
i think there is a function for building URI's from arrays or you could write one yourself. but if you want to use requests thats the way you have to do it.
however, if you are creating an authorization system the preferred method is through the use of sessions w/ a database.