Home > Article > Backend Development > php form processing operation_php example
This article mainly introduces the relevant learning materials of PHP form processing operations in detail. It has certain reference value. Interested friends can refer to it.
I have been studying PHP by myself recently and I just happened to learn it. Let’s talk briefly about the form.
First of all, I use two software here, one is PHPstudy and the other is phpstorm.
The installation is also very simple, so I won’t go into details here.
Steps: 1. Open phpstudy
That’s it:
2.Open the editor , I use phpstorm, because my phpstudy is saved in the e drive.
So I created two files directly in the directory E:\phpStudy\PHPTutorial\WWW, one is index.php and the other is welcome.html.
The following is the code of the two files
index.php
欢迎<?php header("Content-Type:text/html;charset=utf-8"); echo $_POST["fname"]; ?>!<br> 你的年龄是 <?php echo $_POST["age"]; ?> 岁。
welcome.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>菜鸟教程</title> </head> <body> <form action="index.php" method="post"> 名字:<input type="text" name="fname"> 年龄:<input type="text" name="age"> <input type="submit" value="提交"> </form> </body> </html>
Let’s talk about it here, header("Content-Type:text/html;charset=utf-8");This One line of code is to solve the problem of Chinese garbled characters in PHP.
Let’s take a look at the renderings.
After clicking submit,
Related recommendations:
thinkphp form upload file And save the file path to the database
Code for writing PHP form data into the MySQL database
php form validation corresponding jquery-validate plug-in
##
The above is the detailed content of php form processing operation_php example. For more information, please follow other related articles on the PHP Chinese website!