Newbie - How to redirect to another URL?
Moderator: General Moderators
Well tonydm I can assure you that:
Works perfect, are you positive that you have no code before this snippet or perhaps even any whitespace?
Code: Select all
<?php
if ($_GETї'id'] == "1")
{
header("location: http://forums.devnetwork.net");
}
else
{
print("Error!");
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<?php $p = $_GET['id']; ?>
<?php if ($p == "1")
{
print("<meta http-equiv=refresh content='0; url=http://forums.devnetwork.com'>");
}
?>
<body>
</body>
</html>
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<?php $p = $_GET['id']; ?>
<?php if ($p == "1")
{
print("<meta http-equiv=refresh content='0; url=http://forums.devnetwork.com'>");
}
?>
<body>
</body>
</html>
Code: Select all
<?php
$p = $_GETї'id'];
if ($p == "1")
{
header("location: http://forums.devnetwork.net");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
</body>
</html>- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
as I said before, any text output before the header call is hit, you'd get that error.. so your code now should be fine, although Joe's should work fine too..
sidenote: please use
sidenote: please use
Code: Select all
tags when posting code.. thanks."please use
Code: Select all
tags when posting code..."
forgive my brain freeze, but what should I have done diffently as edicate? thanks