need autofill function in view |
I have some text boxes in my view like this:
<?=form_input(['name'=>'last_name','type'=>'text','style'=>'text-transform:capitalize','class'=>'form-control','placeholder'=>'Enter your last name','value'=>set_value('last_name')])?> i have a database table 'userlogin' which has a field 'last_name' when I am entering the value in the last_name field, i want autofill function in it with all the values from 'last_name' field in database. How do i do this?
The easiest way is to gather all the field data you need in the controller and then pass it to the view.
Assuming the controller calls a model that returns a $user_data object like this PHP Code: $data['first_name'] = $user_data->first_name; Then in the view PHP Code: <?= form_input([ Use the same idea for the last_name field. PHP Code: <?= form_input([ |
Welcome Guest, Not a member yet? Register Sign In |