The following sample code is used to explain:
1. When loading the page for the first time, because the form is not submitted, $ _ post is an empty array. At this time, $ _ post ['name'] is null, that is, the variable $ name has not been set,
Isset determines that isset ($ name) is false;
2. When the page has been loaded but no input is made at the input username, when the form is submitted, $ _ post ['name'] is an empty string, that is, the variable $ name has been set;
Isset determines that isset ($ name) is true;
Conclusion: 1. When an empty form is submitted, $ _ post ['variable name'] submits a null string, but it is definitely not null. When isset is used for determination, the result is true, so in some cases,
You must use isset [$ name] = ''to determine whether to use it;
2. The form passing effect in get mode is the same as that in post mode. You should also note that.
Example:
<? PHP
$ Name = $ _ post ['name'];
Echo '<br> ';
If (isset ($ name )){
Echo $ name. "<br> ";
Echo "if the proof \ $ name is empty <br> ";
}
Else {
Echo $ name. "<br> ";
Echo "if the proof \ $ name is null is displayed here <br> ";
}
?>
<HTML>
<Head>
<Title> DSAF </title>
</Head>
<Body>
<Form method = "Post" Action = "isset. php">
<P> enter the User name: </P>
<Input type = "text" name = "name">
<Br>
<Input type = "Submit" value = "Submit">
</Form>
</Body>
</Html>
Welcome to the station
Http://www.hiwhat.com