The Rocket-related Codeigniter User Guide indicates that attributes other than name and value are passed to form_input () as an array:
$data = array( 'name' => 'username', 'id' => 'username', 'value' => 'johndoe', 'maxlength' => '100', ); echo form_input($data); // Would produce: <input type="text" name="username" id="username" value="johndoe" maxlength="100" size="50" />
To expand the Rocket response, passing 'placeholder'=>'my_placeholder' to this array should result in a placeholder attribute.
$data = array( 'name' => 'username', 'id' => 'username', 'value' => 'johndoe', 'maxlength' => '100', 'size' => '50', 'style' => 'width:50%', 'placeholder' => 'my_placeholder' ); echo form_input($data);
Keep in mind that the attr placeholder is very new and not supported in all browsers. Check out this article in the html center for html5, jQuery, and pure javascript methods for creating placeholders.
source share