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

[eluser]Kenan[/eluser]
[quote author="CroNiX" date="1404664228"]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.[/quote]

thanks for answer! but.. when i use cleaning such as

Code:
$q = htmlspecialchars(strip_tags(stripslashes(trim($this->input->post('q')))));

or such as

Code:
$q = $this->security->xss_clean($this->input->post('q'));

it doesn't work, i mean === doesn't work, and == works, that's why i confused

and my last question at the topic wasn't answered, pls


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