Page 2 of 2

Posted: Fri Aug 06, 2004 1:28 pm
by tonydm
Joe, that did the trick!

Posted: Fri Aug 06, 2004 1:30 pm
by Joe
No problem! ;)

Posted: Fri Aug 06, 2004 1:33 pm
by tonydm
Thanks Joe, Feyd, and ldomingues. Never got answer so quick on a forum. This is great!!!

tonydm

ps: still can't get it to work the other way. Stuff like this will drive me nuts. I'll still monkey with it.

Posted: Fri Aug 06, 2004 1:39 pm
by feyd
this is sorta the normal response time on the forums, if we understand the question... :D

Posted: Fri Aug 06, 2004 1:39 pm
by Joe
Well tonydm I can assure you that:

Code: Select all

<?php
if ($_GETї'id'] == "1")
{
header("location: http://forums.devnetwork.net");
}
else
{
print("Error!");
}
?>
Works perfect, are you positive that you have no code before this snippet or perhaps even any whitespace?

Posted: Fri Aug 06, 2004 1:39 pm
by Joe
this is sorta the normal response time on the forums, if we understand the question...
Very true indeed, hehe

Posted: Fri Aug 06, 2004 1:41 pm
by tonydm
<!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>

Posted: Fri Aug 06, 2004 1:43 pm
by Joe

Code: Select all

<?php
$p = $_GET&#1111;'id'];
if ($p == "1")
&#123;
 header("location: http://forums.devnetwork.net");
&#125; 
?>
<!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>
Place it before html, thats why you are getting this error! Also tony, please make sure you have read the forum posting rules, hehe. (you should place your code in between the appropiate tags!)

Posted: Fri Aug 06, 2004 1:44 pm
by tonydm
Every example of php script from php.net docs and other tutorial sites, as far as I have observed has the code in the body. That interesting.

Posted: Fri Aug 06, 2004 1:46 pm
by Joe
Yes tony, PHP can be anywhere, however when you are using headers, cookies etc you must place before any output...

Posted: Fri Aug 06, 2004 1:46 pm
by feyd
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

Code: Select all

tags when posting code.. thanks.

Posted: Fri Aug 06, 2004 1:49 pm
by tonydm
"please use

Code: Select all

tags when posting code..."

forgive my brain freeze, but what should I have done diffently as edicate?  thanks

Posted: Fri Aug 06, 2004 1:50 pm
by feyd

Posted: Fri Aug 06, 2004 1:53 pm
by tonydm
my appologies! I can see the advantage. Thanks for the grace period. Thanks all once again.

Posted: Fri Aug 06, 2004 1:54 pm
by Joe
Yes, these tags hold many advantages to us all. :D