Categories

Tuesday, April 16, 2024
#919814419350 therichposts@gmail.com
JavascriptPhp

Go back to previous page with help of php or javascript

Javascript Array methods cheat sheet part - 1

Go back to previous page with help of php or javascript

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.

therichpost
the authortherichpost
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 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

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