Home > Backend Development > PHP Problem > How to jump to php interface with parameters

How to jump to php interface with parameters

Guanhui
Release: 2023-02-28 21:28:02
Original
4214 people have browsed it

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>
Copy after login

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>
Copy after login

3. Add text box and submit button

Add the following code in the "form" tag

<!-- 输入框 -->
<input type="text" name="这里是参数名">
<!-- 提交按钮 -->
<button type="submit">提交</button>
Copy after login

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就是你的参数名
Copy after login

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!

Related labels:
php
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