2

I have a large registration form and if a user makes any mistake and failed on server side validation then how could I show up the fields which were previously correct.

How can I send the post data back to the registration form?

Mohammad Faisal
  • 5,783
  • 15
  • 70
  • 117
  • How does the server respond to an invalid form? What exactly is returned? Is the validation happening on submitting the form or are you sending the data via AJAX? – Lix Sep 24 '13 at 12:24
  • 1
    no I'm not using any `ajax`. The form is just submitted using `post` request. snippet: `
    `
    – Mohammad Faisal Sep 24 '13 at 12:28

2 Answers2

4

Store the POST values in session on your action page. In your html check if session value exists and then echo that. Expire the session once you are clear with server side validation.

sandy
  • 1,126
  • 1
  • 7
  • 17
0

whenever you are submitting the value of myvalue2 without filling the value of myvalue1 it will you an error with the posted data back

if(isset($_POST['submit']))
{
  if($_POST['myvalue1'])
   {
     $erromsg;
   }
}    

<input size="10" type="text" value="<?php echo $_POST['myvalue1']; ?> name="camp_click_value" id="xyz" />
<input size="10" type="text" value="<?php echo $_POST['myvalue2']; ?> name="camp_click_value" id="xyz" />
SagarPPanchal
  • 9,839
  • 6
  • 34
  • 62