Is it possible to timely redirect back a user to the page from where he entered the page ?
if he entered the page from 1.php
to ----> 2.php
i need a delay redirect to 1.php
redirect always to the page where he entered the other page
You could use a meta tag:
<?php if (!empty($_SERVER['HTTP_REFERER'])) { ?>
<meta http-equiv="refresh" content="2;url=<?php echo $_SERVER['HTTP_REFERER'] ?>">
<?php } ?>
Otherwise, you can use a JavaScript solution:
<head>
<script type="text/javascript">
setTimeout("window.location = '<?php echo $_SERVER['HTTP_REFERER'] ?>'", 2000);
</script>
</head>
PHP isn't dynamic (and not clientside) so you can't make timers. You'll have to use a meta tag or JavaScript. See this answer: Redirect with PHP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With