title: restore input field value on submit of form using php
body: <p>I am working on php form submit, and i have php validation for form.</p>
  
  <p>The registration page name say "page1.php" and retrieving field values in other page say "page2.php". if validation throughs error. it will redirect to other page say "page3.php" on click of any link in "page3.php" it will redirect back to registraion page i.e "page1.php" but i am not able to store or retain values entered by user. can any one suggest or guide me how to over come this,</p>
  
  <p>below is the code i used.</p>
  
  <p>Page2.php</p>
  
  <pre><code>$name = $_POST['txtname'];
  $_SESSION['txtname'] = $name;
  </code></pre>
  
  <p>page1.php </p>
  
  <pre><code>&lt;input type='text' name="txtname" id="txtname" value="&lt;?php echo $_SESSION['txtname']; ?&gt;"/&gt;
  </code></pre>