<?php  
    $pass="";
    if(isset($_POST['update']))
    {
        $pass = mysql_real_escape_string($_POST['pass']);
        $id =  mysql_real_escape_string($_GET['id']);
        
        if(!$id){
            echo'<div class="alert alert-danger absolue center text-center" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">×</span>
                    </button>
                    <span class="text-danger">Error occured while trying to fetch pass info.</span>
                </div>';
        }else
        if(!$pass){
            echo'<div class="alert alert-danger absolue center text-center" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">×</span>
                    </button>
                    <span class="text-danger">Enter Pass</span>
                </div>';
        }else 
        {
            if(!$insert = mysql_query("UPDATE pass SET name='$pass',updated_by='$stafNo' WHERE passID='$id'")){
                echo'<div class="alert alert-danger absolue center text-center" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">×</span>
                        </button>
                        <span class="text-danger">'.mysql_error().'</span>
                    </div>';
            }else
            {
                $pass="";
                $_SESSION['success']="true";
                header('Location:pass.php');
                echo "<script type='text/javascript'> document.location = 'pass.php'; </script>";
                exit();
            }
        }
       
    }  
?>