Jerry, here's the code for the 3 pages ...
INDEX.PHP
-----------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="page1.php">
<label>
<input type="text" name="textfield" />
</label>
<p>
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
</p>
</form>
</body>
</html>
--------------------------
PAGE1.PHP
--------------------------
<?php
session_start();
$_SESSION['1'] = $_POST['textfield'];
echo $_SESSION['1'];
echo "<pre>\n";
print_r($_SESSION);
echo "</pre>\n";
?>
<p> </p>
<p><a href="page2.php">page 2</a</p>
-----------------------------
PAGE2.PHP
-----------------------------
<?php
session_start();
$var = $_SESSION['1'];
echo $var;
echo "<pre>\n";
print_r($_SESSION);
echo "</pre>\n";
?>
-----------------------------
Page 2 doesn't show any sessions registered.
Nothin at alll ....
Jerry Stuckle wrote:
Quote:
Maximus wrote:
Quote:
The same script thats working fine online on link:
http://www.tam-sms.com is not working on my wamp server locally.
I think there's a problem with the php.ini file installed by WAMP5
server.
Jerry Stuckle wrote:
Quote:
>Maximus wrote:
>
>>Lately, i installed WAMP server on my pc, and started coding as always.
>>
>>Today, I noticed that sessions started going weird.
>>
>>I declare a session in page1 for example, I echo it in page2 after a
>>form submission ... al goes fine ... then click a link on page2 leading
>>to page 3 ..... the session is no longer valid.
>>
>>echoing the session gives NULL
>>
>>
>>What's wring? any help?
>>I am using session_start(); in all 3 pages.
>>
>
>Are you calling session_start before ANYTHING is sent to the client?
>This can include any DOCTYPE, etc. statements, or even white space.
>
>What happens if you add the following two statements right at the
>beginning of your file (before the session_start() call)?
>
>error_reporting(E_ALL);
>ini_set("display_errors","1");
>
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>jstucklex@attglobal.net
>==================
>
If that were the case I wouldn't expect it to work at all.
>
What happens if you do a
>
echo "<pre>\n";
print_r($_SESSION);
echo "</pre>\n";
>
And what happens if you use the code I sent you earlier?
>
What's the actual failing code?
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================