Thursday, November 7, 2013

Form dalam Codeigniter

- form helper harus diupload  :

$this->load->helper('form');

Perintah-perintah dalam form helper:

-form_open (file_tujuan,atribute,hidden_input_fields) 


contoh :
$attributes = array('class' => 'email', 'id' => 'myform');
$hidden = array('username' => 'Joe', 'member_id' => '234');
echo form_open('email/send', $attributes);

akan menghasilkan kode HTML sbb :

form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send">
<input type="hidden" name="username" value="Joe" />
<input type="hidden" name="member_id" value="234" />


-form_open_multipart() 

Untuk upload file/gambar

-form_input('nama','value')

$data = array(
              'name'        => 'username',
              'id'          => 'username',
              'value'       => 'johndoe',
              'maxlength'   => '100',
              'size'        => '50',
              'style'       => 'width:50%',
            );

echo form_input($data);

// Would produce:

<input type="text" name="username" id="username" value="johndoe" maxlength="100" size="50" style="width:50%" />

 

form_password()

form_upload()

form_textarea()

form_dropdown('name','value','selected',JS)

$js = 'id="shirts" onChange="some_function();"';
echo form_dropdown('shirts', $options, 'large', $js);


form_multiselect()

form_fieldset_close()

form_checkbox()

form_radio()

form_submit()

form_label()

form_reset()

form_button()

form_close()

form_prep()

set_value()

set_select()

set_checkbox()

set_radio()

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

No comments:

Post a Comment