tag to jump to xxx.php , obtain the passed value through "$_GET['id']"; 3. SESSION passes the value. Once saved in SESSION, other pages can be obtained through SESSION."/> tag to jump to xxx.php , obtain the passed value through "$_GET['id']"; 3. SESSION passes the value. Once saved in SESSION, other pages can be obtained through SESSION.">
Home > Article > Backend Development > How to log in and jump to pass value in php
php login jump value transfer method: 1. POST value transfer, use the HTML "form" form jump method to perform post value transfer; 2. GET transfer value, use the tag to jump After entering xxx.php, obtain the passed value through "$_GET['id']"; 3. Pass the value in SESSION. Once saved in SESSION, other pages can be obtained through SESSION.
The operating environment of this tutorial: Windows 10 system, php8.1.3 version, Dell g3 computer.
php login jump value transfer method:
1. POST value transfer
Post value transfer is used for htmlff9c23ada1bcecdd1a0fb5d5a0f18437 The form jump method is very convenient to use. For example:
<html> <form action='' method=''> <input type='text' name='name1'> <input type='hidden' name='name2' value='value'> <input type='submit' value='提交'> </form> </html>
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 $_POST['name'], for example:
<?php $a=$_POST['name1']; $b=$_POST['name2']; ?>
here A very convenient tip. When selecting type as 'hidden' in the input tag, the input tag will be hidden and will not be displayed on the page. However, if the input tag is in the form and has a name value and a value value, it will also follow The submit button is passed, and this hidden label can pass some content that you don't want to display.
2. GET value transfer
GET transfer value is passed by following the url. When the page jumps, it jumps with the url. Commonly used in the use of 3499910bf9dac5ae3c52d5ede7383485 tags. For example:
<a href='delete.php?id=value'>点我跳转</a>
After jumping to xxx.php, 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.
3. SESSION value transfer
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']); ?>
The above is the detailed content of How to log in and jump to pass value in php. For more information, please follow other related articles on the PHP Chinese website!