FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » session question
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: session question [message #177670 is a reply to message #177665] Thu, 12 April 2012 17:43 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 12.04.2012 18:43, schrieb William Gill:
> I have a site with an input form that recursively calls itself via action="<?php echo
> $_SERVER['PHP_SELF']; ?>", and a couple links with url encoded data that indicate
> simple selections w/o using a form. It uses different include('file'); statements
> based on the progress and/or choices previously made, and it works fine, but is a
> little complicated to track "state" when troubleshooting, updating, or changing.
>
> I am thinking of using a session approach which would be simpler to follow, but have
> never used sessions on a page that is recursively called.
>
> First since session_start() would be called every iteration, that will cause an error
> unless I encapsulate it in an if loop to see if the session already exists. Is this
> the preferred method?
>
> Second, when the user is finished and receives an acknowledgement I plan to call a
> session_unset() to clear things up so that if they want to do it again, they are
> beginning with a clean slate. Again, is this the preferred method?
>

call session_start() at the beginning of your script.

Do not use session_unset(), it is old as Scott said. Assign null to your session
variables, or unset() them, but do not unset($_SESSION)

See
http://groups.google.com/group/comp.lang.php/browse_thread/thread/8b3b25491 e095a49/76d6a3eeb680f503

there is an example of session usage.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Date/Time warning
Next Topic: How to create an instance from a class name
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 04:00:45 GMT 2024

Total time taken to generate the page: 0.04370 seconds