Home  >  Article  >  Backend Development  >  How to jump to php interface with parameters

How to jump to php interface with parameters

Guanhui
GuanhuiOriginal
2020-05-02 14:49:474144browse

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.

How to jump to php interface with parameters

#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[&#39;var_name&#39;];//这里的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!

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