Basically I am using codeigniter and have LOTS of fields in each row for a database table.
(for this example I’ll pretend its a blog entry with just title/postbody but thats only to keep it simple)
I know i could manually code in something like this:
(psedudo code)
if (!$submitted) {
$data = get_existing_data_from_db();
$showform=true;
}
if ($submitted) {
if (process_and_save_data_if_all_valid_data()) {
echo "done";
}
else {
$data = get_data_from_submitted_data();
$showform=true;
}
}
if ($showform) {
echo "<form>";
echo "<input type='text' name='title' value='{$data->title}' />";
}
but is there any CI class or library that would let me do something more along the lines of this (again, pseudo code)
$fields_to_edit = array('title','postbody');
$this->form_helper->edit_table_with_fields('posts', $fields_to_edit);
and the form_helper thing would automatically validate (obviously id set the rules) + show the form to the user, and save it (update mysql) if all correct
does something like this exist for code igintor?
This form builder may make things easier for you. http://formigniter.org/
I think what you’re looking for is a “codeigniter CRUD generator”, just Google this and you will find quite a few. Picking one is up to you. Example 1, Example 2…