How to transfer variables between pages

Source: Internet
Author: User
Tags form post php session


I sent $mes to another PHP page, which is , cannot be called, and the workaround is hard to find.

Reply content:



I sent $mes to another PHP page, which is , cannot be called, and the workaround is hard to find.

If it's a multi-page app.
Then you can re-export the variable to the front end in the querystring back end.
http://url/a?key=value
If it's a single page app, we recommend using the history API
pushStatepopStateand thereplaceState

There are two modes of delivery

The first, explicit

Passed through the URL query string, http://dict.youdao.com/search?q=中国 for example, where the q argument is passed

The second type, implicit

Through the session in PHP, the content to be passed is pre-saved in the PHP session, the page after the jump to the next page to take the value of the session

In PHP:
$_get An array of variables passed to the current script through the URL parameter.
$_post An array of variables passed to the current script via the HTTP POST method.

So, you can pass the variable that you want to pass to the next page either through the URL or through the form post to the next page.

Criticize:

You think $mes will get the result of this JS implementation, which shows that you are too weak basic skills, or it is necessary to fill the basic knowledge.

  • 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.