
如何带参数跳转php界面
1、新建HTML文件并写入HTML表单
<!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、设置“action”和 “method”
“action”:是需要提交PHP文件地址。
“method”:是提交方法,有两种提交方法分别是“get”和“post”。
<form action="你的php文件地址" method="get"></form>
3、添加文本框和提交按钮
在“form”标签里添加下面代码
<!-- 输入框 -->
<input type="text" name="这里是参数名">
<!-- 提交按钮 -->
<button type="submit">提交</button>
4、提交表单
首先双击打开HTML文件,然后在输入参数,最后点击提交。

5、在php中接收参数
在php中可以通过“$_GET”来接收参数,如果你是“post”提交过来的,可以通过“$_POST”来接收。
<?php
//接收get传过来的参数
$var = $_GET['var_name'];//这里的var_name就是你的参数名
以上就是如何带参数跳转php界面的详细内容,更多请关注天达云其它相关文章!