Hi all,
I'm a PHP newbie.
Have studied manual & searched tutorials without luck...
I need to send the user to a specified URL at a point in code - hyperlinks are not appropriate as it is not to be reliant on user interaction. Is there a command something like Forward("next.htm") ?
Thanks for help,
Tony
Forward command
Moderator: General Moderators
Use either one of these:
OR
Hope that helps,
PhIrUs
Code: Select all
<?
header("Location: http://www.example.com/");
?>Code: Select all
<meta http-equiv="refresh" content="0;URL=http://www.example.com">PhIrUs
The header() function will only work at the start of a page (before any content is outputted). You'd have to use JavaScript or something to do it mid-page probably.
I had this script from ages ago:
I had this script from ages ago:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<script language="JavaScript1.1">
<!--
location.replace("http://www.new.site/page.html");
//-->
</script>
<noscript>
<meta http-equiv="Refresh" content="0; url="http"://www.new.site/page.html" />
</noscript>
</head>
<body>
This page has moved to a <a href="http://www.new.site/page.html">new location</a>.
</body>
</html>try and use header...
both javascript and meta refresh can be disabled and sometimes are because redirects can be a security risk when playing with personal info.

If you are having problems with using header() because of the "headers already sent error", look up output buffering in the manual as well as here: http://www.newbienetwork.net/content.php?id=42