This article mainly introduces the php verification form Check Method to check whether the field is empty. It involves php verification form skills and is very useful. For more information, see
This article mainly introduces the php verification form Check Method to check whether the field is empty. It involves php verification form skills and is very useful. For more information, see
This example describes how to check whether a field in a php form is empty. Share it with you for your reference. The details are as follows:
Php verifies the form and checks whether the field is empty. If there are fields not filled in the form, an error message is displayed.
Php back-end code, saved as: ErrorCheck. php
<? Php $ errorcount = 0; if (! Trim ($ _ POST ['nickname']) {echo"
NicknameIs required. "; $ errorcount ++;} if (! Trim ($ _ POST ['title']) {echo"
TitleIs required. "; $ errorcount ++;} if ($ errors> 0) echo"
Please use your browser's back button "." to return to the form, and correct error (s) ";?>
The trim () function removes the trailing and trailing null characters in the string.
"" (ASCII 32 (0 × 20), an ordinary space. "\ t" (ASCII 9 (0 × 09), a tab. "\ n" (ASCII 10 (0x0A), a new line (line feed ). "\ r" (ASCII 13 (0x0D), a carriage return. "\ 0" (ASCII 0 (0 × 00), the NUL-byte. "\ x0B" (ASCII 11 (0x0B), a vertical tab.
I hope this article will help you with php programming.