I'm having little problem, I'll try to describe what is it about: at first page I got only form input field (username expected), then on submit I'm proceed to second page where I got form with fields that I've read from database and put them inside input value="xxx"
. When i retype some of that fields, and submit on next script form parameters are empty($field) == true
. Fields are not empty and when I submit they are marked as empty variables.
Here's my code hope it will help:
My second page view (CODE)
My controller's method to take parameters from second page view (CODE)
Here's screenshots maybe it can be helpful:
i.stack.imgur.com/1zx9S.png
i.stack.imgur.com/3UH97.png
i.stack.imgur.com/ipB6Y.png
Anyone got idea why am I getting empty variable when I read them in script?
Thanks in advance
I'm honestly sorry, I've just realized that in mixing that php and html, I've forgot to add name attribute in html tags.
You should pass a data array to the db. Something like this
public function submitEditChanges($id){
$data = array(
'name' => $this->input->post('name'),
'surname' => $this->input->post('surname'),
'city' => $this->input->post('city'),
'email' => $this->input->post('email'),
'username' => $this->input->post('username'),
'password' => sha1($this->input->post('password')),
'passconf' => sha1($this->input->post('passconf'))
);
$this->db->where('id', $id);
$this->db->update('users',$data);
}