How can I redirect web page with PHP ?
-
Hi there. Do you know how I can redirect web page only with php like this code : function redirect($url, $time) { $table = "
Please Wait ....
"; $javascript =" setTimeout(\"redirect()\",$time); function redirect() { window.location = \"$url\"; } "; print($javascript); print($table); exit; } Sorry for my English. I'm a freshman .
-
Hi there. Do you know how I can redirect web page only with php like this code : function redirect($url, $time) { $table = "
Please Wait ....
"; $javascript =" setTimeout(\"redirect()\",$time); function redirect() { window.location = \"$url\"; } "; print($javascript); print($table); exit; } Sorry for my English. I'm a freshman .
There is a really easy way to do this.
<?php
header("Location: http://google.com");
?>Make sure nothing is sent to the client before this line of code. If you need any more help check out http://au.php.net/header[^]
Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.
-
There is a really easy way to do this.
<?php
header("Location: http://google.com");
?>Make sure nothing is sent to the client before this line of code. If you need any more help check out http://au.php.net/header[^]
Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.
Thanks Bradml. but I know it. I want the script like upper function. for example I want redirect web page after 5 second . Do you know that? Thanks in advance
Sorry for my English. I'm a freshman .
-
Thanks Bradml. but I know it. I want the script like upper function. for example I want redirect web page after 5 second . Do you know that? Thanks in advance
Sorry for my English. I'm a freshman .
PHP is a server side language so no that is not possible. The way it is normally done is to use the code that you have above or a meta refresh tag. Check out meta refresh at wikipedia Meta_refresh[^]
Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.
-
PHP is a server side language so no that is not possible. The way it is normally done is to use the code that you have above or a meta refresh tag. Check out meta refresh at wikipedia Meta_refresh[^]
Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.
Thanks Bradml.
Sorry for my English. I'm a freshman .
-
Thanks Bradml.
Sorry for my English. I'm a freshman .
No problem.
Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.
-
PHP is a server side language so no that is not possible. The way it is normally done is to use the code that you have above or a meta refresh tag. Check out meta refresh at wikipedia Meta_refresh[^]
Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.
Thanks Bradml. your answer was great. You're nice ;)
Sorry for my English. I'm a freshman .
-
Thanks Bradml. your answer was great. You're nice ;)
Sorry for my English. I'm a freshman .
Glad to here it. Welcome to the Code Project community.
Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.
-
Hi there. Do you know how I can redirect web page only with php like this code : function redirect($url, $time) { $table = "
Please Wait ....
"; $javascript =" setTimeout(\"redirect()\",$time); function redirect() { window.location = \"$url\"; } "; print($javascript); print($table); exit; } Sorry for my English. I'm a freshman .
-
Thank you. I used this function. I think this is better.
function redirect($url, $time)
{
$table = "
<html>
<head>
<META http-equiv=\"refresh\" content=\"$time;URL=$url\">
</head>
<body bgcolor=\"#847d6d\">
<div style=\"background-color:#ECE9D8; width:250px; margin:0px auto; text-align:center;\">
Please Wait .... <img align=\"absmiddle\" src=\"../template/default/Image/ProgressBar.gif\">
</div>
</body>
</html>";
print($table);
exit;
}Freshman