I am creating simple PHP update script. In that, whenever I update data form does not shows updated data. Means update query work and record is updated successfully but updated data does not reflects in text box in form. But whenever I refresh/redirect page again then it shows updated text in text box. Below is the code.
<?php
    mysql_connect("localhost","root","");
    mysql_select_db("test");
    if(isset($_POST['update']))
    {
      $txt =  $_POST['txt'];
      $que= mysql_query("update test set test='$txt' where id='1'");
    }
    $que= mysql_query("select * from test where id=1");
    $data=mysql_fetch_array($que); 
    $test = $data[0];
?>
  <form method="post">
   <input type="text" name="txt" value="<?php echo $test; ?>">
   <button name="update">Update</button>
 </form>
 
     
     
     
    