problems with cookies
Moderator: General Moderators
problems with cookies
I need to transfer one cookie to a third page.As I understood the cookie needs to be set before any output.The problem is that I need to transmit through that cookie on what it has been clicked.Can you help me?Is there a way to know from which page you have been redirected to the curent one?
- chrys
- Forum Contributor
- Posts: 118
- Joined: Tue Oct 04, 2005 9:41 am
- Location: West Roxbury, MA (Boston)
Re: problems with cookies
You should look into sessions.sebs wrote:I need to transfer one cookie to a third page.As I understood the cookie needs to be set before any output.The problem is that I need to transmit through that cookie on what it has been clicked.Can you help me?Is there a way to know from which page you have been redirected to the curent one?
http://www.php.net/session_start
It basically goes like this:
put session_start(); at the very top of every page in your site.
To register a variable, set it like this:
$_SESSION['var'] = "john";
Then on your next page:
echo $_SESSION['var'];
Output will be:
john
Just make sure to have session_start at the top of the page before any output.
- chrys
- Forum Contributor
- Posts: 118
- Joined: Tue Oct 04, 2005 9:41 am
- Location: West Roxbury, MA (Boston)
Could you paste the error?sebs wrote:ok,but if I do that it gives me a php error in windows and still not working.I'm using phptriad with a new php,I think 5.And I can't put on the very top of every page because I have some static pages between them
Are you running this off of IIS or Apache in Windows?
- chrys
- Forum Contributor
- Posts: 118
- Joined: Tue Oct 04, 2005 9:41 am
- Location: West Roxbury, MA (Boston)
Ah it's an executable error... that's really weird, and it shouldn't be doing that because of PHP code. I have no experience with windows apache, so I Can't help there. But let's take a look at the code. Can you paste the code for the file that is crashing?sebs wrote:I am running apache.the error that gives windows XP(all errors of windows are given the same)only that it sais php.exe created the error.
Please use
Code: Select all
tags for posting PHP code andCode: Select all
tags for other code or output
If you are receiving executable errors with php.exe, you have either a corrupt Apache installation, corrupt PHP installation, corrupt Windows installation or any combination of the above.
Fix those, else you will forever receive errors that you will think is your code