Home > Article > Backend Development > How to jump to php interface with parameters
How to jump to the php interface with parameters
1. Create a new HTML file and write it into the HTML form
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>表单</title> </head> <body> <!-- 添加表单 --> <form></form> </body> </html>
2. Set "action" and "method"
"action": It is necessary to submit the PHP file address.
"method": It is the submission method. There are two submission methods: "get" and "post".
<form action="你的php文件地址" method="get"></form>
3. Add text box and submit button
Add the following code in the "form" tag
<!-- 输入框 --> <input type="text" name="这里是参数名"> <!-- 提交按钮 --> <button type="submit">提交</button>
4. Submit the form
First double-click to open the HTML file, then enter the parameters, and finally click Submit.
#5. Receive parameters in php
In php, you can receive parameters through "$_GET", if you are Submitted by "post", it can be received through "$_POST".
<?php //接收get传过来的参数 $var = $_GET['var_name'];//这里的var_name就是你的参数名
The above is the detailed content of How to jump to php interface with parameters. For more information, please follow other related articles on the PHP Chinese website!