简体   繁体   中英

define, that the user came from specific page? (in PHP)

Is there the way in PHP to define, that the user came from specific page? without "post" requests.
I have a "add post" page. when user submit a post, on the next page he can submit some more information. But when user click "back" in browser he returns to blank "add post" form, and what I need is that the user can modify previously submitted info, but only if he presses back from this second page.

$_SERVER['HTTP_REFERER'] - doesn't seem to work.
Maybe I can set some data in $_SESSION on second page and celar it on every other page except the first.. but its seems like not very smart.

PHP $_SESSION is a great, easy fix for storing temporary data (especially if you can't use $_POST). You only need to clear the SESSION value once, not on every page.

I'm not 100% clear on what you're asking, but try looking at some other values in $_SERVER; they may have what you need.

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