I found the solution on the manual:
echo form_input($auto_focus);
where $auto_focus is (create it):
$auto_focus = array(
'autofocus' => 'autofocus',
);
echo form_input($auto_focus);
http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html search for (ctrl + f) *form_input()* on this page
Your code will be:
<body>
<div id="wrapper">
<div id="text">
<h2>Login</h2>
<?php
$auto_focus = array(
'name' => 'username',
'autofocus' => 'autofocus',
);
echo form_open('login/validateform');
echo 'user name';
echo form_input($auto_focus);
echo 'password';
echo form_password('password', '');
echo form_submit('submit', 'Login');
//dont forget to close php
?>
</div>
</div>
</body>
Before using php, and library, be sure to know how to write good html code... You made lot of mistakes.