php method to jump to the page and pass the value: 1. POST value passing method, used for html [
How to jump to the page and pass the value in php:
1. POST pass the value
Post value is a method used for html form jump, which is very convenient to use. For example: <pre class='brush:php;toolbar:false;'> <html>
<form action=&#39;&#39; method=&#39;&#39;>
<input type=&#39;text&#39; name=&#39;name1&#39;>
<input type=&#39;hidden&#39; name=&#39;name2&#39; value=&#39;value&#39;>
<input type=&#39;submit&#39; value=&#39;提交&#39;>
</form>
</html></pre>
The action in the form is filled in with the url path of the jump page, and the method is filled in with the post method. After the submit button in the form is pressed, all the content with name in the form will be transferred to the filled in URL, which can be obtained through
, for example: <pre class='brush:php;toolbar:false;'><?php
$a=$_POST[&#39;name1&#39;];
$b=$_POST[&#39;name2&#39;];
?></pre>
There is a very convenient trick here. When selecting type as 'hidden' in the input tag, the input tag will be hidden and will not be displayed on the page. However, the input tag is in the form and has a name value and The value value will also be passed along with the submit button. This hidden label can pass some content that you do not want to display.
GET transfer value is passed by following the url. When the page jumps, it jumps with the url. Commonly used in the use of
tags. For example: <pre class='brush:php;toolbar:false;'><a href=&#39;delete.php?id=value&#39;>点我跳转</a></pre>
After jumping to
, you can get the passed value through $_GET['id']
. The GET method is often used in URLs to delete or read a php file with a certain ID.
SESSION is a type of global variable, which is often used to save common data such as user ID after the user logs in. Once saved to SESSION, other pages can be obtained through SESSION. To use SESSION, you need to open the session:
<?php //session赋值 session_start(); $_SESSION['one']=value1; $_SESSION['two']=value2; //session值的读取: $one = $_SESSION['one']; //session值的销毁 unset($_SESSION['one']); ?>Related learning recommendations:
PHP programming from entry to master
The above is the detailed content of How to jump to the page and pass value in php?. For more information, please follow other related articles on the PHP Chinese website!

The article compares ACID and BASE database models, detailing their characteristics and appropriate use cases. ACID prioritizes data integrity and consistency, suitable for financial and e-commerce applications, while BASE focuses on availability and

The article discusses securing PHP file uploads to prevent vulnerabilities like code injection. It focuses on file type validation, secure storage, and error handling to enhance application security.

Article discusses best practices for PHP input validation to enhance security, focusing on techniques like using built-in functions, whitelist approach, and server-side validation.

The article discusses strategies for implementing API rate limiting in PHP, including algorithms like Token Bucket and Leaky Bucket, and using libraries like symfony/rate-limiter. It also covers monitoring, dynamically adjusting rate limits, and hand

The article discusses the benefits of using password_hash and password_verify in PHP for securing passwords. The main argument is that these functions enhance password protection through automatic salt generation, strong hashing algorithms, and secur

The article discusses OWASP Top 10 vulnerabilities in PHP and mitigation strategies. Key issues include injection, broken authentication, and XSS, with recommended tools for monitoring and securing PHP applications.

The article discusses strategies to prevent XSS attacks in PHP, focusing on input sanitization, output encoding, and using security-enhancing libraries and frameworks.

The article discusses the use of interfaces and abstract classes in PHP, focusing on when to use each. Interfaces define a contract without implementation, suitable for unrelated classes and multiple inheritance. Abstract classes provide common funct


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.