Welcome Guest, Not a member yet? Register   Sign In
[Can't use method return value in write context] for checking a form variable
#1

[eluser]sahanlak[/eluser]
This function is within a controller,

Code:
function settings()
        {
            $data['members']=TRUE;

            $this->load->model('user_model');
            $user=$this->user_model;
            /*-- Update Settings --*/
            
            if( isset($this->input->post('update')) )
            {
                $name=$this->input->post('name');
                $pp_email=$this->input->post('pp_email');
                $country=$this->input->post('country');
                
                $user->update_user($name, $pp_email, $country);
            }
            
                        
            $data['action']='settings';
            $data['user_data']=$user->get_user();
            
            $this->load->view('members/home', $data);
        }

I'm getting an error @ [if( isset($this->input->post('update')) )]

Why?

Erro:
Quote:Can't use method return value in write context
#2

[eluser]theprodigy[/eluser]
you don't need to check if it's set. Just use:
Code:
if( $this->input->post('update') )
CodeIgniter will return a false if there is no variable in post with that key

From the user_guide:
Quote:The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist.




Theme © iAndrew 2016 - Forum software by © MyBB