Auto Redirect - PHP Tutorials - php Form

Author Topic: Auto Redirect - PHP Tutorials  (Read 16178 times)

Offline admin

  • Administrator
  • *****
  • Posts: 67
  • Karma: +10/-0
  • Gender: Male
    • View Profile
Auto Redirect - PHP Tutorials
« on: June 19, 2007, 07:49:40 PM »


Code: [Select]
<?php

$URL
="http://phpform.net/board";
header ("Location: $URL");

?>
« Last Edit: May 25, 2008, 04:55:14 PM by admin »

Offline Roby

  • Supporter
  • **
  • Posts: 4
  • Karma: +1/-0
    • View Profile
Re: Auto Redirect - PHP Tutorials
« Reply #1 on: May 09, 2008, 03:07:15 PM »
Redirect in PHP without header( "Location:...:");

Code: [Select]
<?php
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.php">';    
exit;
?>
« Last Edit: May 25, 2008, 04:56:52 PM by admin »

Offline omentrance

  • Supporter
  • **
  • Posts: 1
  • Karma: +1/-0
    • View Profile
Re: Auto Redirect - PHP Tutorials
« Reply #2 on: December 11, 2008, 10:28:27 PM »
I am new to this forum and have been reading all the posts. 

Even though this is an old post I think it should be noted that the meta refresh as a redirect is not recommended by the W3C even though it is almost universally supported now.

Also the header (location) redirect must be processed before any output to the browser.

Offline cilipe

  • VIP
  • ****
  • Posts: 14
  • Karma: +1/-0
    • View Profile
Timed Redirect JavaScript
« Reply #3 on: October 10, 2009, 02:56:31 AM »
Code: [Select]
<?php
$redirect 
'http://phpform.net';
?>

<SCRIPT LANGUAGE="JavaScript">
redirTime = "550";
redirURL = "<?php echo $redirect ?>";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
</script>
<BODY onLoad="redirTimer()">
:) :)
« Last Edit: October 10, 2009, 04:05:37 PM by admin »

Offline alex

  • Global Moderator
  • *****
  • Posts: 77
  • Karma: +19/-0
    • View Profile
Re: Auto Redirect - PHP Tutorials
« Reply #4 on: October 12, 2009, 12:41:09 AM »
Code: [Select]
<?php
$redirect 
'http://phpform.net';
echo 
"<center><font face=\"tahoma\">Click <a href=\"$redirect\">here</a> if your browser does not automatically redirect you</font></center>";
?>

<SCRIPT LANGUAGE="JavaScript">
redirTime = "2550";
redirURL = "<?php echo $redirect ?>";
function redirTimer() {
self.setTimeout("self.location.href = redirURL;",redirTime);}
</script>
<BODY onLoad="redirTimer()">
8) 8) 8) 8) 8) 8)