Home > Backend Development > PHP Tutorial > PHP obtains the URLs of the first two pages by hiding the form control, form URL_PHP tutorial

PHP obtains the URLs of the first two pages by hiding the form control, form URL_PHP tutorial

WBOY
Release: 2016-07-13 10:19:13
Original
925 people have browsed it

php obtains the URLs of the first two pages by hiding the form control, form url

I also encountered similar problems during my study:
For example, the background wants to look like this:

But the actual situation is like this:

Solution:
By hiding form controls

<input type="hidden" name="prevurl" value="<&#63;php echo $_SERVER['HTTP_REFERER']&#63;>">
Copy after login

In this way, the value of $_SERVER['HTTP_REFERER'] seems to be temporarily stored in $_POST[prevurl].

In fact, the principle of this method is to post the previous URL to another place through the post method, but this post is the current page

In the future development, there will be a select tag in the newly created article. If the select tag is disabled, the selected value will not be posted, so I once again used the hidden deception method and submitted it secretly. Once, tried and true.

How to get the URL of the submission page through php

PHP $_SERVER['HTTP_REFERER']
Using $_SERVER['HTTP_REFERER'] will easily get the address of the previous page linked to the current page.
$_SERVER['HTTP_REFERER'] is only valid for pages accessed via hyperlinks and POST or GET forms.

PHP uses URL to pass variables, can I submit it without using a form?

Except for pictures, you can use URL to pass variables
The acquisition method is such as a.php?a=123
Then use $_GET['a'] to output
If there are multi-level variables You can use a.php?a=123&b=456&c=789
echo $_GET['a'] 123 echo $_GET['b'] 456
Write a function to filter the best variables to ensure Web Security
In fact, even if you use GET, you can still use post to get the value in the form. If you don’t get it, you can check whether the post and get settings are turned off

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/876527.htmlTechArticlephp obtains the url of the first two pages by hiding the form control. The form url has also been encountered during the learning process. Similar questions: For example, the background wants to be like this: But in reality...
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template