In project development often see the value of different pages in the Web work, this article gives you a list of three common ways.
A. Post Pass value
The post pass value is a method of <form> form jump for HTML, which is easy to use. For example:
The action in form fills in the URL path of the jump page, and method fills in the post methods. When the Submit button in form forms is pressed, the name in the form is uploaded to the URL that is filled in, and can be obtained by $_post[' name ', for example:
<?php
$a =$_post[' name1 '];
$b =$_post[' name2 '];
? >
Here is a very handy trick, in the input tag to select the type ' hidden ', the input tag will be hidden, not the page display, but the input tag in the form, and has a name and value value, the same will follow the submit button passed past, This hidden tag can pass something that you don't want to show.
Two. Get Pass value
Get pass value is passed by following the URL, when the page jumps, follow the URL jump. Used in <a> label use. For example:
<a href= ' delete.php?id=value ' > Dot i jump </a>
After jumping into xxx.php, you can get the value passed by $_get[' id '. A Get method is commonly used for URLs to delete or read a PHP file for an ID.
Three. Session Pass value
Session is a global variable, often used for users to save the user ID after logging the common data. Once saved to session, other pages can be obtained through session, the session will be used to open session:
<?php
//session assigned value
session_start ();
$_session[' one ']=value1;
$_session[' two ']=value2;
Reading of Session value:
$one = $_session[' one '];
The destruction of the session value
unset ($_session[' one ']);
? >
Thank you for reading, I hope to help you, thank you for your support for this site!