How would I go about creating the following:
I am looking to create a dropdown menu full of form input types but when one is selected I would like it to create the respective html for the input and save it to the database. I will be using codeigniter.
Example:
If I select Text Area from the dropdown menu it will then create <textarea></textarea> so then I could escape it and save it to the database.
I have come up with the following code so far
if (isset($_REQUEST['general_options']))
{
$optionName = $_REQUEST['general_options'];
$optionValue = strtolower(str_replace(" ", "", $_REQUEST['general_options']));
//$this->load->view( $page, $data, FALSE);
echo form_label($optionName, $optionValue);
echo form_input($optionValue, '', '');
}`
`
Unless your intent on reloading the page every time you make a select choice, your best bet is to incorporate something like jQuery which is a javascript library.
Then with that you can do something like
A note worth mentioning is just cause Codeigniter has a form helper class, and makes it sound through its docs that its the only way to build a form on your page. Standard HTML forms work just as well in your views.