EllisLab text mark
Advanced Search
[Can’t use method return value in write context] for checking a form variable
Posted: 29 September 2010 12:35 PM
Joined: 2010-09-28
30 posts

This function is within a controller,

function settings()

/*-- Update Settings --*/
if( isset($this->input->post('update')) )

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



Can’t use method return value in write context

Posted: 30 September 2010 12:31 AM   [ # 1 ]   [ Rating: 0 ]
Joined: 2008-11-18
678 posts

you don’t need to check if it’s set. Just use:

if( $this->input->post('update') ) 

CodeIgniter will return a false if there is no variable in post with that key
From the user_guide:

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


Quality Coder | Looking for work? | Logo by InsiteFX