Reputation: 4961
Is there a method to prepopulate a certain field in a form using data from the previous page using codeigniter.
I have a page with input fields that are filled out, if the user presses a "add" button they are given a new form with similar fields. I want those fields to be populated from data received by the previous page.
Upvotes: 0
Views: 236
Reputation: 2276
You can use CI's form helper function set_value() which uses the $_POST and may save you some code testing if the $_POST value is empty because you can specify a default value if not set. Should be using this anyway if your using CI's form validation.
Upvotes: 1
Reputation: 22674
You could store the data entered in form 1 in sessions or in the database and display it in the second form. Or as mentioned use $_POST
in the second form to retrieve submitted data from the previous.
Upvotes: 0