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 #177691 is a reply to message #177686] Fri, 13 April 2012 17:51 Go to previous messageGo to previous message
William Gill is currently offline  William Gill
Messages: 31
Registered: March 2011
Karma:
Member
On 4/13/2012 9:27 AM, Denis McMahon wrote:
> Nope. Recursive is the wrong term to use here. It calls itself, yes, but
> does not do so in a truly recursive manner.
>
>> 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.
>
> This is not recursive calling. In recursive calling, a function calls
> itself from within itself.
>
> In a web page that includes a link back to itself, it has completed all
> processing before it is called again.
>
> Just include a single call to session_start() at the start of the main php
> script file, and don't call it on the included php script files.

Though I agree with your definition of recursive calling of a function,
I'm not sure the term recursive is limited to functions. However maybe
repetitively would have been a better choice.

To clear up some things for some of the other respondents, the page gets
called several ways.

1) The initial GET domain/page.php which includes() an intro and list of
links.

2) A second GET from one of the links:
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?whoDoYouWantToContact=John">
which then includes() the HTML form.

3) A POST from the form:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
which then includes() a process the form script and an acknowledgement
that the data was received.

Denis, my testing confirms that you are correct, placing the
session_start() on the core page does not produce errors on subsequent
GETS or POSTS. Which makes logical sense, but seemed to conflict with
the manual. Thanks, helping clear that up.
[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 05:57:50 GMT 2024

Total time taken to generate the page: 0.04556 seconds