I have a function that creates an HTML form lines View by placing the requested variables into the array to produce the following:
<input type=\"text\" name=\"name\" value=\"\" id=\"name\" class=\"\" />
What I am trying to do now is create a way to edit the specific field via the same form as the add, but I am unsure how to get the current:
- name
- value
- class
- placeholder – set by dropdown box with an input field if “yes” is selected
- type – sets the input type
How could I extract this data?
My DB Structure is as below I was thinking I could have it so I have a row for each paramater and then the label and field row that I then edit with any changes.

I have tied the following:
$testLabel = $field_info->label;
$testPrint = preg_replace("/\([^\)]+\)/","",$testLabel);
$data['test'] = $testPrint;
Label = <label for=\"name\">Name</label>\n
This gave me Name/n but I am unsure how I could build a function to get the specific data I need and also set the dropdown boxes.
$field_info:
private function fieldInformation($id)
{
$id = $this->uri->segment(4);
$information = $this->form_model->showFieldInformation($id);
return $information[0];
}
The codeiginter Form Validation class is what you need.
Using the functions there, you can prefield your forms with data from the database, whilst also ensuring validation on each field.