Form processing for beginners in PHP
PHP Forms and User Input
The $_GET and $_POST variables in PHP are used to retrieve information in the form, such as user input.
PHP Form Processing
One very important thing to note is that when processing HTML forms, PHP can automatically make form elements from the HTML page available to PHP scripts.
Example
The following example contains an HTML form with two input boxes and a submit button.
form.html file code is as follows:
php中文网(php.cn)
When the user fills out the above form and clicks the submit button, the form data will be sent to the PHP file named "welcome.php" :
welcome.php file is as follows:
"; echo "您的年龄是:".$age."岁!"; //本段代码是结合上段代码一起使用的,建议在本地新建俩个文件,form.html 提交到 welcome.php ?>