Home > Backend Development > PHP Tutorial > How to implement form submission using PHP?

How to implement form submission using PHP?

怪我咯
Release: 2023-03-10 19:14:02
Original
2815 people have browsed it

How to use PHP or javascript to achieve the following functions: Submit the data entered in form1 in 1.html (php) to another web page 2.html (php ) or txt text,

Solution:

Create go.php, the code is as follows

<?php
@$username = $_POST[&#39;name&#39;];
@$usermessage = $_POST[&#39;message&#39;];
if(!empty($username) || !empty($usermessage)){
 echo "您的姓名:".$username.",您的留言内容:".$usermessage;
} else{
 echo &#39;<form action="go.php" method="post">
您的姓名:<input type="text" name="name">
<br><br>
留言内容:<input type="text" name="message">
button>提交</button></form>&#39;;
}
?>
Copy after login

Case screenshot:



How to implement form submission using PHP?

How to implement form submission using PHP?

The above is the detailed content of How to implement form submission using PHP?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template