Hi,

I have a problem with Session with Button post value. Following is the code.

PHP Code:
<?php

session_start
();

if(isset(
$_POST["b1"]))
    
$_SESSION["e0"] = $_POST["b1"];
else
    
$_SESSION["e0"] = "n";

if(isset(
$_POST["b2"]))
    
$_SESSION["e1"] = $_POST["b2"];
else
    
$_SESSION["e1"] = "n";

?>

<html>
<head>
<title>Submit</title>
</head>
<body>
<form name="f" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
<?php

    
if($_SESSION["e0"] == "n")
        echo 
"<input type='submit' name='b1' value='#f0'><br>";

    if(
$_SESSION["e1"] == "n")
        echo 
"<input type='submit' name='b2' value='#f1'><br>";

?>
</form>
</body>
</html>
I would like to do the following,
1. On clicking 1st button its value will be stored in $_SESSION["e0"] and it will not shown later. Same is going to follow with the 2nd button. After clicking both the buttons the page will be redirected to a new page (that will be done).

But the code is giving a different result,
1. At first both the buttons are displaying (its OK, as required).
2. After clicking 1st button its disappear and only 2nd button has been shown (its OK, as required).
3. After clicking the available 2nd button its disappear, but the 1st button is displayed once again (its not OK, wrong).
It should not appear and the page will be redirected to the new page.


In this situation I need assistance. Please help me. Thanks a lot.