Go Back to Previous Page

前端 未结 11 684
悲哀的现实
悲哀的现实 2020-12-02 07:20

I am using a form to \"Rate\" a page. This form \"posts\" data to a php script elsewhere. I simply want to display a link after the form is processed which will bring the us

11条回答
  •  悲哀的现实
    2020-12-02 08:09

    Try this:

    $previous = "javascript:history.go(-1)";
    if(isset($_SERVER['HTTP_REFERER'])) {
        $previous = $_SERVER['HTTP_REFERER'];
    }
    

    in html:

    Back
    

    The JavaScript code is initialize as fallback for HTTP_REFERER variable sometimes not work.

提交回复
热议问题