I have the following section of if statements that creates the respective code dependent on what option the user has selected from the view.
How could I save the selected options if statement so that I could insert it into the db.
I have tried 'field' => ''.$_REQUEST['add_fields_type'].'' but of course it just shows the selected option and not the html it should produce
Code:
if (isset($_REQUEST['add_fields_type']))
{
if($_REQUEST['add_fields_type'] == 'input')
{
//$fieldLabel;
form_input($formData, TRUE);
}
if($_REQUEST['add_fields_type'] == 'textarea')
{
$fieldLabel;
form_textarea($formData, TRUE);
}
if($_REQUEST['add_fields_type'] == 'radiobutton')
{
$fieldLabel;
form_radio($formData, TRUE);
}
if($_REQUEST['add_fields_type'] == 'checkbox')
{
$fieldLabel;
form_checkbox($formData, TRUE);
}
Instead of doing:
You should do this if you want to save the HTML:
Or if you want to save the field data with field type, then do this: