I have update profile view and my form is fully working. I need when i load this form it should be pre filled with database values instead of empty. i dont want to use sessions. I am using cakephp 3.8 version and in update_profile.ctp file i have below code
echo $this->Form->control('firstname',['minlength'=>3, 'value'=>'' ]);
echo $this->Form->control('lastname',['minlength'=>3]);
Given below is the updated function
public function updateProfile() {
$user = $this->Users->newEntity();
$userId = $this->Auth->user('id');
$userData = $this->Users->get($this->Auth->user('id'));
if ($this->request->is('post')) {
//has post data execution code
}
//$this->set(compact('user'));
$this->set(compact('userData'));
}
You had passed "user" variable, you have to pass userData since in this variable u have fetched the user details. Once this is passed form will get pr-populated.