Domanda

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?

È stato utile?

Soluzione

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.

Altri suggerimenti

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" />
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top