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.
return post data on server side validation failure
-
29-06-2022 - |
Pergunta
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?
Solução
Outras dicas
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" />
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow