RE: [PHP] understanding session vars ?

From: Date: Thu, 24 Nov 2005 10:42:46 +0000
Subject: RE: [PHP] understanding session vars ?
Groups: php.general 
Request: Send a blank email to php-general+get-226408@lists.php.net to get a copy of this message
On 24 November 2005 10:24, Gregory Machin wrote: > I have a test script.. > What i'm trying to achieve is once the user has clicked on > link1 the value > of item must equal x and if the user clicks on link2 the > value of items must > stay equal to x while setting action equal to y .. > > <?php > session_start(); > echo 'Welcome to testpg'; > $_SESSION['time'] = time(); > > > if (isset($_GET['item'])){ > $_SESSION['item'] = $_GET['item']; > echo $_SESSION['item']; > } > > if (isset($_GET['action'])){ > $_SESSION['action'] = $_GET['action']; > echo $_SESSION['action']; > } > > > > > <html><br /><a href="test.php?item=x&<?php echo strip_tags(SID); > > ">link1</a></html> > <html><br /><a href="test.php?action=y&<?php echo strip_tags(SID); > > ">link2</a></html> This is not how you use <html> tags -- you need one <html> tag at the beginning of your output page, and one </html> tag at the end. Additionally, you shouldn't need to strip_tags(SID) -- if the constant SID exists, it will be well-formed. What are the value of your session.use_trans_sid, session.use_cookies and session.use_only_cookies settings? Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

« previous php.general (#226408) next »