Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead)
Asked Answered
S

1

-2
if(isset($_GET['a'] or $_GET['b'])){
  echo "ok";
}else{
  echo "no";
 }

i have two var for one condition when isset $_GET['a'] or $_GET['b']
always echo ok either echo no

Syntactics answered 17/8, 2015 at 22:57 Comment(3)
Should be isset(…) or isset(…)Shame
Well the error message already says everything. What you probably want is (pseudo code): isset(a) || isset(b)Schafer
@Shame Is it already bourbon time again :]?Schafer
H
0

isset takes only one input not two

it should be

if(isset($_GET['a']) OR isset($_GET['b']))
{
echo 'ok';
}
else
{
echo 'nope';
}
Henke answered 17/8, 2015 at 23:3 Comment(2)
try it there is always echo 'nope'Syntactics
i had missed a ' inside the a index. and the reason why its not working for you is because either $_GET['a'] or $_GET['b'] is not set. are these values in the url as parameters or are they post fields on the form?Henke

© 2022 - 2024 — McMap. All rights reserved.