Possible Duplicate:
Back button re-submit form data ($_POST)

some guys suggest me rather then editing the question put it as new question that's why i am doing so...


if(isset($_POST['username']) && ($_POST['password'])) 

                die('Could Not Connect:'.mysql_error());


                $usr=$_POST["username"];                 //pick username from login page
                $pwd=hash('sha1',$_POST['password']);    //pick password from login page and use hash algorithm to encrypt it

                $query="select * from employee where Username='$usr' and Password='$pwd'";  //serch that single row in which both r found

                    if ($result) 


                        if (($row["Username"]==$usr) && ($row["Password"]==$pwd))

                                $_SESSION['employee']['id']=$row['User Id'];
                                echo "Login Not Successfull";

echo 'Error! Username & Password were not sent!';

$_SESSION['user_authenticated'] = true;


<body bgcolor="black">


                                echo "<font color=red>"."<h3 align=center>"."Welcome ".$_SESSION['employee']['username']."</h3>"."</font>";
                                echo "<br />"."<a href='upload_file.php'>"."<font color='white'>"."<h4>"."Up-Load Files"."</h4>"."<font>"."</a>";
                                echo "<br />"."<br />"."<a href='list_files.php'>"."<font color='white'>"."<h4>"."List All Up-Loaded Files"."</h4>"."<font>"."</a>";



<a  href="logout_file.php"><font color="white"><h3 align="right">Sign Out</h3></font></a>
<font color="white">


Ok fine now i am getting the point.But there is one more problem.Suppose i am on signin-action page which have a link of sign out.When i click on sign out button i am re-directed to sign in page.ok no problem but again if i press back button again i am asked to resend the data(even after sign out) and again i am on sign-in-action page why so. It is wrong yar..What to do this.For all other pages like if i click on sign out button from upload button->redirected to sign-in and if i press back button it shows u are signed out. I don't know how to check session variable exit for signinaction

as felix sir told me to check this

but really i am not getting what this guy is saying.I am sorry i am not so techanical becuase i am a begineer I know what problem i am facing...

as far as i know

    if (count($_POST)) {             //checking how many time data is being resend.
        // process the POST data
   add_comment($_POST);        //what this function do i dont know 

   // redirect to the same page without the POST data
header("Location: ".$_SERVER['PHP_SELF']);  //i think it is like  
                                //refreshing without get input again from allpication form

Please, explain it, especially what is this $_server(;PHP_SELF)

No correct solution


About $_SERVER - see this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow