Example of PHP using super global variable $_POST to receive form data

高洛峰
Release: 2023-03-04 10:08:01
Original
1914 people have browsed it

Use the $_POST super global variable to receive the form data, and then use echo to output it to the page.

The following is the code:

<!doctype html>
<html>
<head>
<title>利用超级全局变量$_POST接收表单</title>
<meta http-equiv="content-type" contnet="text/html" charset="utf-8"/>
</head>
<body>
<form method="post" action="<?php echo $_SERVER[&#39;PHP_SELF&#39;];?>"/>
Name:<input type="text" name="fname"/>
<input type="submit"/>
</form>
<?php
$name= $_POST[&#39;fname&#39;];
echo $name;
?>
</body>
</html>
Copy after login

The output content uses the post method to submit the data, and then uses $_POST['fname']; to receive the data assignment Go to the global variable of $name,

and then use echo to output the $name; variable to get the final result, which is the content in the form. .............

 PHP利用超级全局变量$_POST来接收表单数据的实例

The above example of PHP using the super global variable $_POST to receive form data This is all the content that the editor has shared with you. I hope it can give you a reference and I hope you will support the PHP Chinese website.

For more examples of PHP using the super global variable $_POST to receive form data, please pay attention to the PHP Chinese website for related articles!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!