I have a 20 page document with 20 forms in it. It's organized into sections.
Section 1:
1.1 - Form 1
1.2 - Form 2
1.3 - Form 3
Section 2:
2.1 - Form 1
...etc...
I have a controller setup that looks something like this (for now):
class Section extends CI_Controller {
public function index($section_id) {
$this->section_model->_require_valid_section($section_id);
$data['view'] = "section/index";
$this->load->view('app/template', $data);
}
}
I need to build views for these 20 forms. Each form has different data. One might have "Name, Email, Phone" while the next might have "Person Name, Facility Name, Title" and they aren't related. I think it is probably silly to have a table for each form (more forms could come at any time), so I could do a table like this:
Section | Key | Value
-------------------------
1.1 name Randolph
1.1 phone 1111111111
2.1 person Junior
2.1 title Playa
I'd really like to know how I could set up my controller to handle and route requests for these forms.
Would it be ideal to just create functions for each one?
public function form_1_1() {
$this->section_model->save_1_1();
}
public function form_1_2() {
$this->section_model->save_1_2();
}
index()
could route the requests via call_user_func()
but I don't know if thats the right way to do it.