RE: understanding session vars ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx
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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux