Get Array
This method returns the html output of the generated form as an associative array. This can be helpful if single form elements need to be passed to a templating system.
Note: The get_array() method will also validate the form data.
get_array ()
$this->load->library('form');
$this->form
->text('uername', 'Username')
->text('password', 'Password')
->submit();
$form = $this->form->get_array();
// pass form html to template
$this->smarty->assign('form', $form);
The form data in $form will look like this:
Array
(
[username] => <input type="text" name="username" value="" onkeypress="this.style.borderColor='#000'" id="username" /><br />
[username_error] =>
[password] => <input type="text" name="password" value="" onkeypress="this.style.borderColor='#000'" id="password" /><br />
[password_error] =>
[submit] => <input type="submit" name="submit" value="Submit" class="button" id="submit" />
[submit_error] =>
[form_open] => <form action="/" method="post">
[form_close] => </form>
[action] => /
[method] => post
)