codeigniter forms
First Load Helper :
$this->load->helper('form');
$action = "users/create"; $attributes = array('class' => 'email', 'id' => 'myform'); echo form_open($action,$attributes); echo form_close();
or for multipart you can use :
echo form_open_multipart($action,$attributes);
Codeigniter Form Fields :
form_input :
$data = array( 'name' => 'name', 'id' => 'name', 'value' => 'Name', 'maxlength' => '100', 'size' => '50', 'style' => 'width:50%', ); echo form_input($data);
form_password() :
$data = array( 'name' => 'password', 'id' => 'password', 'value' => 'Password', 'maxlength' => '100', 'size' => '50', 'style' => 'width:50%', ); echo form_password($data);
Complete Code Together :
$action = "users/create"; $attributes = array('class' => 'email', 'id' => 'myform'); echo form_open($action,$attributes); $data = array( 'name' => 'name', 'id' => 'name', 'value' => 'Name', 'maxlength' => '100', 'size' => '50', 'style' => 'width:50%', ); echo form_input($data); $data = array( 'name' => 'password', 'id' => 'password', 'value' => 'Password', 'maxlength' => '100', 'size' => '50', 'style' => 'width:50%', ); echo form_password($data); echo form_submit('mysubmit', 'Submit'); echo form_close();