简体   繁体   中英

Redirect to Previous Page After Message

I want to go back to previous page after pressing "OK" on the function message prompted.

Php Code

function function_alert($message) { 
  
    // Display the alert box  
    echo "<script>alert('$message');
    document.location='javascript://history.go(-1)';
    </script>";
    } 

    // Function call 
    function_alert("This email has already subscribed");
 }

Alert Box

Thank you so much!

Tried this

function function_alert($message) { 
    echo "<script>
          alert('$message')
          history.back()
          </script>";
}

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