Hi, I wanted to know if using $_SERVER['PHP_SELF'] resets the session?

Vinay

New member
Hi, I am finding the session value is being reset each time I submit the form. The snippet is as follows

<?php
session_start();
if(!isset($_SESSION['abc'])
{
$_SESSION['abc']=$_GET['id']; //takes value from URL, Say 99
}
echo $_SESSION['abc']; // THIS IS PROBLEM AREA
?>
<html>
<body>
<form action="<? php echo "$_SERVER['PHP_SELF']"; ?>" method="POST">
<input.....
<input.....
<input type="submit" value="submit" name="submit">
</body>
</html>

The problem is each time I submit the form. I am expecting to see the same session value printed out. BUT as soon as hit submit the value disappears and prints nothing...
However IF I MAKE action="" in the form THEN each time I submit the form the value of $_SESSION['abc'] is still the same, 99.

why is this ? Does $_SERVER['PHP_SELF'] reset the session ? or is it anything in the configuration ?
 
Back
Top