Third-order operator notice prompt
$act = isset($_POST['act']) ? $_POST['act']:(isset($_GET['act']) ? $_GET['act']:'login');
Why must the last three orders operator in the code be enclosed in parentheses? If not, a notice error occurs.
Reply to discussion (solution)
There is no such phenomenon
Notice: Undefined index: act in C: \ Users \ John \ Desktop \ shop \ admin \ privilege. php on line 3
At least you didn't reflect this.
What's going on? How can I report a notice?
You mean me #3?
The second line $ act is used directly without assigning a value (echo $ act;). it is necessary to report notice.
However, the third line does not contain the parentheses you want to add, but does not report the notice
I am doing this to prove that I have not blocked notice-level errors.
I also didn't use @ blocking errors. how can I add brackets without naotice errors or parentheses.
No problem.
It is estimated that the code you provided is incomplete. the notice is from other places.
I still don't know the reason. without parentheses, notice says this variable is not defined. I have var_dump and The act also has data:
Array (4) {["act"] => string (6) "signin" ["username"] => string (0) "" ["password"] => string (0) "" ["captcha"] => string (0 )""
I changed it to this.
$act = isset($_REQUEST['act']) ? $_REQUEST['act']:isset($_REQUEST['act']) ? $_REQUEST['act']:'login';
Unified $ _ REQUEST