Ask a question about how to determine the parameter passed by $ _ POST. there is a new modification function on the webpage that cannot be retrieved. one is & lt; input & nbsp; nameid & nbsp; this parameter is used to determine whether to add or modify the parameter. if it is a new addition, id]) & nbsp; & amp; & nb asks a question about how to determine whether to pass the parameter $ _ POST. the number cannot be obtained.
The web page has a new/modified function, 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 passed value is 0, this statement is not executed. if the passed value is 00, this statement is executed.
} Else {
Modify user
}
}
CleanParameters ($ _ GET );
CleanParameters ($ _ POST );
?>
------ Solution --------------------
$a = '0';
var_dump(! empty($a));//bool(false)
Let's take a look at empty's description.
The rules are for your compliance, and may be somewhat unsatisfactory.
------ Solution --------------------
If ($ pid = 0) {There is a problem here, $ pid has no value, $ pid = $ _ POST ['id ']
Empty-check whether a variable is empty
Bool empty (mixed $ var)
The rule for this method is as follows:
If var is a non-null or non-zero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, array (), var $ var; and objects without any attributes will be considered empty, if var is null, TRUE is returned.
If you want to judge that 0 is not empty, you can write it like this.
If (isset ($ _ POST ['id']) & isset ($ _ POST ['uname']) &! (Empty ($ _ POST ['id']) & $ _ POST ['id']! = 0 )&&! Empty ($ _ POST ['uname']) {