Welcome Guest, Not a member yet? Register   Sign In
form parameter disapear when validation and redirecting
#1

[eluser]Oussama M Billah[/eluser]
Hello,

I have a page that is generated from posting a form from the previous page. now the page contains fields that need to be validated.
When the validation fails, I return the user to the same page using redirect.
When the user is redirected back to the page. the form fields that were generated from the previous page are now empty.

how can I keep the parameters from the previously submitted form in the current page after validation?

Thanks.
Oussama
#2

[eluser]rogierb[/eluser]
You can store them in your session, use flash data or store them in the database.

If it is not to much data, store it in the session
#3

[eluser]Alur[/eluser]
If you are using the validation class you should load the form view within the controller when validation fails (instead of redirecting).
#4

[eluser]oliur[/eluser]
you can simply use
Code:
echo form_input('username_txt','array('value'=>set_value())')
or

Code:
<input type="text" name="username_txt" value=<?php echo set_value('username_txt')?>




Theme © iAndrew 2016 - Forum software by © MyBB