PHP Three common ways of transmitting values to different pages and the problem of the value of PHP and HTML, phphtml_php tutorial

Source: Internet
Author: User

PHP Three common ways of transmitting values to different pages, and the problem of the transfer of PHP and HTML, phphtml


In the project development often see the different pages between the value of the web work, this article gives you a list of three common ways.

Contact PHP also has a few months, this article summarizes this period of time, in the programming process commonly used in 3 different page value method, I hope you can refer to everyone. I hope we can discuss it together.

I. Post-pass value

The post pass value is used for HTML

The action in the form fills in the URL path of the jump page, which is filled in with the post method. When the submit button is pressed in the form form, the contents of name in the form are uploaded to the filled URL, which can be obtained by $_post[' name ', for example:

<?php$a=$_post[' name1 '; $b =$_post[' name2 '];? >

Here is a handy tip, when the type is selected as ' hidden ' in the input tag, the input tag is hidden and not displayed on the page, but the input tag is in the form and has a name and value value, which will also follow the commit button to pass in the past. This hidden tag can pass something that you don't want to show.

Two. Get Pass value

The get value is passed by following the URL, and then the URL jumps when the page jumps. Commonly used for label use. For example:

Point me to jump

After jumping into xxx.php, you can get the value passed by $_get[' id '. The Get method is commonly used for URLs that are intended to delete or read a PHP file of an ID.

three. Session Pass value

Session is a global variable, often used to save user ID and other common data after user login. Once saved to the session, the other pages can be obtained through the session, session use to open session:

<?php//session Assignment Value  session_start ();  $_session[' one ']=value1;  $_session[']=value2;//session value reads:  $one = $_session[' one ');  SESSION Value Destruction  unset ($_session[' one ');? >

The above is a small list of three ways for everyone to refer to, at the same time I hope you like.

The problem of the value of the transfer between PHP and HTML

Such a form I use a form how to send value to PHP, the focus is how PHP receives such data

------to solve the idea----------------------

Form form two parameters, an action, indicating to which file to pass, do not write their own default, a method, indicating in what way, there are get and post two kinds

Input box plus name

Accepted files are received in $_post (POST mode) or $_get (GET mode). The simplest is direct var_dump ($_post) or Var_dump ($_get) and then you know how to invoke the

http://www.bkjia.com/PHPjc/1073119.html www.bkjia.com true http://www.bkjia.com/PHPjc/1073119.html techarticle PHP Transfer value to different pages of three common Ways and PHP and HTML transfer value problem, phphtml in the project development often see the value of the different pages in the Web work, this article to everyone column ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.