I have something which I find quite interesting. Till now I have yet to find any answers or anything which is close or even resembles what I really need.
This is basically what I have...
Page 1 --> Page 2 --> Page 3 --> Page 4
My problem is how do I make it in such a way that someone needs to actually go to Page 1 before going to Page 2, 3 or 4? Is there a way to actually do this? I would appericiate it if someone could help tell me what I could do to get this going.
Thank you very much.
Help with PHP Page Coding
Moderator: General Moderators
Re: Help with PHP Page Coding
Well basicly you can do it with simple cookie..
on page 1, set cookie
on page 2,3 and 4, check for that cookie, if found, let in, if not, redirect to page1
on page 1, set cookie
on page 2,3 and 4, check for that cookie, if found, let in, if not, redirect to page1
Re: Help with PHP Page Coding
That's my basic problem...
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by... (the session script on the session_start() function).
The funniest thing is that my entire page has only 2 JavaScript and 1 Form in HTML. No sessions or anything or even headers at all. Not even sure why it's giving me that problem.
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by... (the session script on the session_start() function).
The funniest thing is that my entire page has only 2 JavaScript and 1 Form in HTML. No sessions or anything or even headers at all. Not even sure why it's giving me that problem.
Re: Help with PHP Page Coding
Please post your code.
Re: Help with PHP Page Coding
That Warning is that you output something before you call session_start() function. You MUST start session BEFORE any output!! So basically, just put it at the top of the file, first line or soaodat2 wrote: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by... (the session script on the session_start() function).
As for the thing you want, use SESSION. No need for cookie really.
AKA if no session is set, go to page 1 no matter which page was called. When user click "page 2" from "page 1", set session to something like $_SESSION['page'] = 2, and so on..
Re: Help with PHP Page Coding
Thanks so much for the help. This might be a stupid question but I'm a total noob and I'm going to ask it anyways. What am I suppose to put in Page 2, 3, 4 and etc?Geteburg wrote:That Warning is that you output something before you call session_start() function. You MUST start session BEFORE any output!! So basically, just put it at the top of the file, first line or soaodat2 wrote: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by... (the session script on the session_start() function).That should fix this Warning.
As for the thing you want, use SESSION. No need for cookie really.
AKA if no session is set, go to page 1 no matter which page was called. When user click "page 2" from "page 1", set session to something like $_SESSION['page'] = 2, and so on..
Hope you could help on this.
By the way, I've got the session thingy down, just don't really know how to use it. Hahaha... gosh, I'm such a noob.
Re: Help with PHP Page Coding
http://www.php.net/session
Read this, it'll light things up..
And you need to check if there's session on pages 2-4
eg.
Read this, it'll light things up..
And you need to check if there's session on pages 2-4
eg.
Code: Select all
if isset($_SESSION['yoursession']) { your code here }