There is a new/modified feature on the Web page, a
if (Isset ($_post[' id ')) && isset ($_post[' uname ']) &&!empty ($_post[' id ')) &&!empty ($_post[') Uname '])) {
$id = $_post[' id '];
$uname = $_post[' uname ');
if ($pid ==0) {
New User---------------------If the value passed in is 0, the statement is not executed, and if the value is 00, the statement is executed.
}else{
Modify User
}
}
Cleanparameters ($_get);
Cleanparameters ($_post);
?>
Reply to discussion (solution)
Because
So
if (Isset ($_post[' id ')) && isset ($_post[' uname ']) &&!empty ($_post[' id ')) &&!empty ($_post[') Uname ']))
Because the part of the set broken is not established, will not enter the branch
Because
So
if (Isset ($_post[' id ')) && isset ($_post[' uname ']) &&!empty ($_post[' id ')) &&!empty ($_post[') Uname ']))
Because the part of the set broken is not established, will not enter the branch
Why would id=0 be considered empty? 0 at least it's a value! It's not empty.
$a = ' 0 '; Var_dump (! empty ($a));//bool (false)
You can see the description of empty
Rules are for you to obey, maybe a little passable.
if ($pid ==0) {There is also a problem here, $pid no value, $pid = $_post[' id ')
Empty? Checks if a variable is empty
BOOL Empty (mixed $var)
That's the way the rules are.
If Var is a non-null or nonzero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, Array (), Var $var; and objects that do not have any properties will be considered empty and return TRUE if Var is empty.
If you want to determine that 0 is non-null, you can write this.
if (Isset ($_post[' id ') && isset ($_post[' uname ']) &&! (Empty ($_post[' id ') && $_post[' id ']!=0) &&!empty ($_post[' uname '])) {
Determine if a form submission requires only
if ($_server[' request_method '] = = "POST")
A little bit more simple is
if ($_post)
The submitted data is always a string, so determine if the ID control is 0
if ($_post[' id ') = = = ' 0 ')
Can
Of course
if ($_post[' id ') = = ' 0 ')
if (Empty ($_post[' id ')))
It's all right, but you can't tell whether it's a blank or a 0.
if ($_post) { $id = $_post[' id ']; $uname = $_post[' uname '); if ($id ==0) { New user---------------------If the value passed in is 0, the statement is not executed, and if the value is 00, the statement is executed. }else{ Modify user }}