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

How to implement form submission using PHP?

怪我咯
怪我咯Original
2017-06-19 10:30:122785browse

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;;
}
?>

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!

Statement:
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
Previous article:How to build php form?Next article:How to build php form?