CodeIgniter Forums
why is this always 'no'? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: why is this always 'no'? (/showthread.php?tid=84828)



why is this always 'no'? - richb201 - 11-14-2022

Can anyone tell me why this always executes to 'no'? With the debugger I can clearly see values for $post_array 

if ((empty($post_array->elimination_of_uncertainty)) && (empty($post_array->technological_in_nature)) &&
            (empty($post_array->permitted_purpose)) && (empty($post_array->process_of_experimentation))) {
            $iComplete = 'no';
        } else {

        $iComplete = 'yes';
    }


RE: why is this always 'no'? - kenjis - 11-14-2022

They are all empty.

$post_array->elimination_of_uncertainty
$post_array->technological_in_nature
$post_array->permitted_purpose
$post_array->process_of_experimentation

empty is a technical term in PHP.
See https://www.php.net/empty


RE: why is this always 'no'? - ikesela - 11-14-2022

show your $post_array value, maybe other method more suitable for checking.


RE: why is this always 'no'? - richb201 - 11-15-2022

(11-14-2022, 03:01 PM)kenjis Wrote: They are all empty.

$post_array->elimination_of_uncertainty
$post_array->technological_in_nature
$post_array->permitted_purpose
$post_array->process_of_experimentation

empty is a technical term in PHP.
See https://www.php.net/empty

Yes, that worked. I used
$post_array->elimination_of_uncertainty!=''
instead.

thx