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 #177692 is a reply to message #177691] Fri, 13 April 2012 19:54 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 4/13/2012 1:51 PM, William Gill wrote:
> 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.
>
>

William, Denis is correct. You are not calling the page recursively.

Recursive is when something calls itself without terminating. Web
scripts are transactional in nature - the first script finishes before
the page is ever presented to the user. So when the user clicks on a
link (or whatever) to request the next page, a brand new request starts
out. Nothing is left over from the previous request except what is sent
in the GET/POST parameters and cookies.

Note that saving data on the server in the $_SESSION still requires the
session ID to be sent in one of the above parameters so you can save
additional data on the server, but this is just to make things easier on
the programmer.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[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: Sun Nov 24 11:04:44 GMT 2024

Total time taken to generate the page: 0.05099 seconds