Is there a Codeigniter way of populating a form with data from the database? For example, if the user edits a previously saved form. Since it’s previously saved then existing data already exists.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There isn’t any direct way of loading data from the database into your forms. BUT:
You can use the template parse library:
http://codeigniter.com/user_guide/libraries/parser.html
You only have to load the data into an array and then the labels into
the form.
Or you can use the
set_value()function, that has a second parameter(optional) that gives the field of a form a default value(very useful editing forms)http://codeigniter.com/user_guide/libraries/form_validation.html#helperreference
Also I’m now working in a third party addon that loads and makes forms automatically, but it’s very alpha to use it, but, there is rabbit forms that makes more or less the same(search for it in google, “rabbit forms codeigniter”, can’t post the hyperlink due to low reputation.