View Single Post
  #1 (permalink)  
Old March 1st, 2006, 02:04 PM is offline
Registered User
Join Date: Mar 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Difficulty with $_SESSION

Hello to everyone reading this.

I am a beginner to PHP, and i am experiencing a few problems with SESSIONS I have set up in a web site I am trying to develop.

My site requires users to login via a username and password, in which I have used session_start();, so I can use this information on the next page. I am incorporating this into all of my pages where I retrieve the username and display it in all the following page headings, welcoming that user to the new page.

Upon logging in, I ask the user to choose what they would like to do next, and all of my links carry over their details I request to their desired next page.

One of the option links requires the user to fill in all the fields. If they choose this and do not enter all the fields and try to submit it an error page is displayed, which I have created which again echoes the session information telling them there is an error. They can resume information entry at this point and submit the form.

Upon completing the form and submitting it, the user gets a confirmation message for a successful submission with the session information also being carried over. Eg Thank you Tim etc...

On this confirmation page, I ask the user if they would like to do the same thing again or go back to the homepage, where of course they choose the appropriate link.

MY PROBLEM OCCURS HERE: either link looses the session information, and I DON'T KNOW WHY! AHHHHHHHHHHHHHHHHHHHH:(.

I have one form, with all the code, which works perfectly until the links are used, at which point I loose all the session info which messes up everything, because the session information is vital.

The only way around it for me at the moment is the have the link redirect them to the login stage again, where of course the session information is re-invoked. That works for now, but it is inefficient!

If anyone can please help me, I would be very greatful.

Thank you.

Reply With Quote