Articles → PHP CODEIGNITER → Form Elements In Codeigniter

Form Elements In Codeigniter





  1. form_input - renders the HTML input element.
  2. form_submit - renders the "Submit" button.
  3. 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




Picture showing output of form_input, form_submit, form_reset methods in view
Click to Enlarge



Picture showing rendered HTML of form_input, form_submit, form_reset methods in view
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, August 4, 2020

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250