简体   繁体   中英

How to get url from page form element is in?

Let assume I've got two pages a.php and b.php with a form-tag in each page. And the action of both of these forms is c.php.

Is it somehow possible to detect in c.php which form (from eigther a or b) called c.php? It's not possible for me to simply use a I need a better solution as this hiden-input could be edited in the developer tools in any browser and any user with some developer knowledge would be able to change the value... The method in the form tags used is post.

Thanks in advance.

You could define the a session in A.php and B.php using something like this.

$_SESSION['last_page'] = $_SERVER['REQUEST_URI'];

and on c.php $send_page = $_SESSION['last_page'];

Make sure to start the session on each page with session_start();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM