Javascript Array methods cheat sheet part - 1Javascript Array methods cheat sheet part - 1

Hello to all, welcome to therichpost.com. In this post, i will tell you, how to Go back previous page with help of php or javascript?

Php and Javascript both are very famous and top languages.

Here is working for Go back to previous page with help of php or javascript:
//JavaScript
<input type="button" value="Go Back From Whence You Came!" onclick="history.back(-1)" />

//or
<button onclick="goBack()">Go Back</button>
<script>
function goBack() {
    window.history.back();
}
</script>

//PHP
<?php
  $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
  echo "<a href='$url'>back</a>"; 
?>

//or

<?php header('Location: ' . $_SERVER['HTTP_REFERER']); ?>

 There are so many tricks in php and javascript and i will let you know all. Please do comment if you any query related            to this post. Thank you. Therichpost.com.

By therichpost

Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.