View Full Version : how to redirect to the previous link
vanz10
01-10-2007, 08:24 AM
hei jho, can you help me and give me a code of redirect to the previous link
koyama
01-10-2007, 08:56 AM
Not sure what you mean, but you should be looking at the header (http://php.net/manual/en/function.header.php) function and the $_SERVER (http://php.net/manual/en/reserved.variables.php) array.
Send the URL of the previous page to the redirecting page using e.g. a post variable.
frosty1433
01-10-2007, 12:47 PM
<?php
$redirect = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : "http://www.codingforums.com/";
header("Location: " . $redirect);
?>
Redirects to the site from which the link was clicked on, but if typed it redirects to codingforums.com.
You can also use Javascript to go backwards, I think it is something like:
<script language="javascript">
<!--
history.go(-1);
//-->
</script>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.