i have two forms , in the first form i am taking an user input with post action and i will run a SELECT query with a WHERE clause, i am using php in the backend. I am storing the retrieved value in a session variable to make it global. i will be displaying the session variable in my second form. The problem is that it shows the old form value in the session variable. is there a way i can load the 2nd form only after i finish the post operation? code for form1 below
<form action="autofillStudent.php" method="post" enctype="multipart/form-data" target="update_target" >
<div class="form-group">
<label for="formGroupExampleInput10">USN</label>
<input type="text" class="form-control" id="formGroupExampleInput10" placeholder="USN" required = " true" name = "qusn">
</div>
<button type="submit" id="toggleform2" class="btn btn-default" name = "Update" required = "true" value="login" >Update student Details</button>
<iframe id="update_target" name="update_target" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe>
</form>
i am posting qusn and storing the database result in $_SESSION['usn']
code for form2 below
<form action="updateStudent.php" method="post" enctype="multipart/form-data">
<label for="formGroupExampleInput2">Name</label>
<input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Name" required = " true" name = "sname" value = <?php echo $_SESSION['usn'];?> >
</form>
Here i have echoed $_SESSION['usn'] , since the form gets loaded before itself, it displays the old value. I want to know a way to call the 2nd form like a function , or just reload that part only. I dont want to refresh the entire page.