how to remember input data in the forms even after refresh page?

on the page where your form is submitting do something like this

    session_start();
    $_SESSION['data'] = $_POST['data'];
    $_SESSION['data_another'] = $_POST['data_another'];

and than you can access those session variables any where like this

    session_start(); // this should be at the top of the page before any html load
    <input type="text" name="name" value="<?php echo $_SESSION['data'];?>"/>

refresh your page on success call like this

     $.ajax({
           type: "POST",
           url: "yourfile.php",
           data: 'data="+ data,
           success: function(){
               location.reload();
           }
       });

Leave a Comment