New to PHP

From: Rick (rick_at_di-wave.com)
Date: 03/07/05


Date: Mon, 07 Mar 2005 15:56:41 GMT

I am having a problem using session verables. I have set up 3 pages for
testing the code is below. The verable displays on page two but not one page
three. Any ideas why?

Thanks for any help you can give!!! I know I am going to feel really stupid
when someone tells me why this is not working but I guess that is the way
you learn.

    Thanks You!

                Rick

First file
test.php
//*********** Start Here
<?php
session_start();
header("Cache-control: private"); // IE 6 Fix.
?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<FORM METHOD="POST" ACTION="test2.php">
Enter your Name: <input type="text" name="name">
<input type="SUBMIT" value="Submit">
</FORM>

</body>
</html>

Second file
test2.php
//*********** Start Here
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
// start the session
session_start();
//header("Cache-control: private"); //IE 6 Fix

// Get the user's input from the form
   $name = $_POST['name'];

// Register session key with the value
   $_SESSION['name'] = $name;

// Display the sssion information:
?>

Welcome to my website <strong><? echo $_SESSION['name']; ?></strong>!<br />
Let's see what happens on the next page.<br /><br />
</body>
</html>

Third file
test3.php
//*********** Start Here
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
Welcome to my website <strong><?php echo $_SESSION['name']; ?></strong>

</body>
</html>



Relevant Pages

  • Re: Arent session variable preserved using "Header(Location: xxx)"?
    ... "Jerry Stuckle" wrote in message ... <html xmlns="http://www.w3.org/1999/xhtml"</a>;> ... But on the target page I don't get any session variable values! ...
    (comp.lang.php)
  • php login script error
    ... header("Cache-Control: private"); ... //register session variable: 'login' and 'pass' ...
    (comp.lang.php)
  • Re: Session Variables in Firefox
    ... Take a look at the privacy options does it allow sites to set cookies. ... Session variables depend on a session cookie for identification. ...
    (microsoft.public.scripting.vbscript)
  • Session variables lost
    ... I write a basic test page "test.asp" as below; ... When browse this page by IE6.0, whenever refresh this page, i see another session ID. ...
    (microsoft.public.inetserver.iis)
  • Re: query string passing woes........ help... please....
    ... |> | offer any help other than saying that my validation could be FAR more ... I'm a total newbie at php. ... The easiest way for you would be to make the html form called form.php ... $_SESSION array using the same names. ...
    (alt.php)