Articles → PHP CODEIGNITER → Form Elements In Codeigniter
Form Elements In Codeigniter
- form_input - renders the HTML input element.
- form_submit - renders the "Submit" button.
- form_reset - renders the "Reset" button.
Example
<?php
$attributes = array(
'method' => 'get',
'id' => 'myform'
);
echo form_open('users_list', $attributes); ?>
<?php
// form_input
// 1. username is name attribute of textbox.
// 2. gyansangrah is value attribute of textbox
$inputattributes = array(
'class' => 'TextBox',
'MaxLength' => '20'
);
echo form_input('username', 'gyansangrah', $inputattributes);
// form_submit
// 1. mysubmit is name attribute of button.
// 2. Submit Post! is value attribute of button
echo form_submit('mysubmit', 'Submit Post!');
// form_reset
// 1. myreset is name attribute of button.
// 2. Reset is value attribute of button
echo form_reset('myreset', 'Reset'); ?><?php echo form_close(); ?>
Output
Click to Enlarge
Click to Enlarge