Welcome Guest, Not a member yet? Register   Sign In
isset: without or with?
#2

[eluser]CroNiX[/eluser]
isset() will always be true in that case because this->input->post() will return boolean false if the variable does not exist, so it will ALWAYS be set (either FALSE, or a value). So you want to check with the === operator.

Code:
$q = $this->input->post('q');
if ($q !== FALSE) //variable existed

You don't want to use (!$q), because what if the post value was "0", which is a legitimate post value in a lot of forms.


Messages In This Thread
isset: without or with? - by El Forum - 07-06-2014, 09:01 AM
isset: without or with? - by El Forum - 07-06-2014, 09:30 AM
isset: without or with? - by El Forum - 07-06-2014, 09:46 AM
isset: without or with? - by El Forum - 07-06-2014, 04:05 PM
isset: without or with? - by El Forum - 07-06-2014, 11:37 PM
isset: without or with? - by El Forum - 07-07-2014, 05:01 AM
isset: without or with? - by El Forum - 07-07-2014, 05:09 AM
isset: without or with? - by El Forum - 07-07-2014, 05:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB