Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #5521
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: session question |
| Date | 2012-04-13 15:54 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <jma09h$o1b$1@dont-email.me> (permalink) |
| References | <jm70n9$r71$1@dont-email.me> <4f8829ac$0$2880$a8266bb1@newsreader.readnews.com> <jm9p3p$c7q$1@dont-email.me> |
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@attglobal.net ==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
session question William Gill <noreply@domain.invalid> - 2012-04-12 12:43 -0400
Re: session question Scott Johnson <noonehome@chalupasworld.com> - 2012-04-12 09:56 -0700
Re: session question "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-12 19:43 +0200
Re: session question "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-12 19:59 +0200
Re: session question Captain Paralytic <paul_lautman@yahoo.com> - 2012-04-13 02:18 -0700
Re: session question Denis McMahon <denismfmcmahon@gmail.com> - 2012-04-13 13:27 +0000
Re: session question William Gill <noreply@domain.invalid> - 2012-04-13 13:51 -0400
Re: session question Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-13 15:54 -0400
Re: session question William Gill <nospam@domain.invalid> - 2012-04-20 02:40 -0400
Re: session question "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-20 10:55 +0200
Re: session question Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-04-20 11:25 +0200
Re: session question Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-20 08:11 -0400
Re: session question William Gill <noreply@domain.invalid> - 2012-04-20 10:59 -0400
Re: session question William Gill <noreply@domain.invalid> - 2012-04-20 11:32 -0400
Re: session question Michael Fesser <netizen@gmx.de> - 2012-04-20 17:50 +0200
Re: session question William Gill <nospam@domain.invalid> - 2012-04-20 12:04 -0400
Re: session question Tim Streater <timstreater@greenbee.net> - 2012-04-20 18:17 +0100
Re: session question "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-20 20:08 +0200
Re: session question Tim Streater <timstreater@greenbee.net> - 2012-04-20 20:36 +0100
Re: session question William Gill <nospam@domain.invalid> - 2012-04-21 18:13 -0400
Re: session question Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-20 14:22 -0400
Re: session question William Gill <nospam@domain.invalid> - 2012-04-20 15:04 -0400
Re: session question The Natural Philosopher <tnp@invalid.invalid> - 2012-04-20 22:09 +0100
Re: session question Michael Fesser <netizen@gmx.de> - 2012-04-20 21:13 +0200
Re: session question Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-20 15:45 -0400
Re: session question Tim Streater <timstreater@greenbee.net> - 2012-04-20 23:11 +0100
Re: session question The Natural Philosopher <tnp@invalid.invalid> - 2012-04-20 23:23 +0100
Re: session question Tim Streater <timstreater@greenbee.net> - 2012-04-21 13:14 +0100
Re: session question Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-20 18:45 -0400
Re: session question Michael Fesser <netizen@gmx.de> - 2012-04-21 01:24 +0200
Re: session question The Natural Philosopher <tnp@invalid.invalid> - 2012-04-21 01:28 +0100
csiph-web