form_input([$data = ''[, $value = ''[, $extra = '']]])
Parameters: |
|
---|---|
Returns: |
An HTML text input field tag |
Return type: |
string |
Lets you generate a standard text input field. You can minimally pass the field name and value in the first and second parameter:
echo form_input('username', 'johndoe');
Or you can pass an associative array containing any data you wish your form to contain:
$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" value="johndoe" id="username" maxlength="100" size="50" style="width:50%" /> */
If you would like your form to contain some additional data, like JavaScript, you can pass it as a string in the third parameter:
$js = 'onClick="some_function()"'; echo form_input('username', 'johndoe', $js);
Or you can pass it as an array:
$js = array('onClick' => 'some_function();'); echo form_input('username', 'johndoe', $js);
Please login to continue.