Code for simple interaction between PHP and html forms

不言
Release: 2023-04-03 18:22:02
Original
5635 people have browsed it

This article brings you the code for simple interaction between html forms and PHP. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

html form part

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表单联合PHP进行交互</title>
</head>
<body>
     <form action="http://localhost/MyService/service.php" method="get">
         <!--action属性代表的是想要运行的网页的地址,methon属性代表方式-->
         <p>用户名:<input type="text" name="name"></p>
         <p>密码:<input type="password" name="passworld"></p>
         <input type="submit" value="确定">
     </form>

</body>
</html>
Copy after login

PHP part

<?php
echo "用户名:".$_GET[&#39;name&#39;]."<br>密码:".$_GET[&#39;passworld&#39;];
//.$_GET前面的.表示的是连结,文字部分用"".这里是HTML所创建的GET的创建方式,要对应
//如果用post方式提交的话,这里就随之改变,post方式直接将用户名和密码添加到地址栏中而post不用,较安全
Copy after login

Related recommendations:

How to implement message board style in html? (Code example)

Mini program and ThinkPHP5 combined to achieve login status (code attached)

The above is the detailed content of Code for simple interaction between PHP and html forms. For more information, please follow other related articles on the PHP Chinese website!

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