<?php/* forms: Publishing and gathering information through forms. Encoding an HTML form is only necessary to effectively accept user input (part), a header function (header ()) header (header) must be handled by the [Server side] Component: The server passes HTML data from the HTTP protocol to the browser between [header] and [HTML file] Requires a blank line to separate. The header () function is used to send an original HTTP header. A void header (string string [, bool replace [, int http_response_code]]) header can be in two forms: 1. Redirect the specified URL header (' Location:ht Tp://www.baidu.com '); 2. Set page character encoding header (' content-type:text/html; Charset=utf-8 '); [note] Unless {output buffering} is enabled, these commands must be placed before statements that return any output. (Just put it at the beginning of the file) enable output buffering: Ob_start (); Accept data using $_post and $_get: 1. The form method sent by $_get[' username ' must be get;2. The form method sent by $_post[' username ' must be post;3. Use Isset () to verify that the $_get[' username '] Super global variable is defined; 4. Use Htmlspecialchars () to filter HTML special characters. Validation of {Data validation}: 1. Trim () Remove the front and back space of the data; 2. Strlen () Determine the length of the data; 3. Is_nuimeric () to determine whether the data is purely numeric; 4. Use {Regular expression} to verify that the mailbox is legitimate. *//*if (!isset ($_post[' send ')) | | $_post[' send ']!= ' commit ') {header (' Location:demo1.php '); exit;} Else{echo "
[PHP] Forms and validation