This article mainly introduces the php verification form check method to check whether fields are empty. it involves php verification form techniques and is very useful, for more information about how to check whether fields are empty, see the example in this article. 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 unfilled fields 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.