0

So one of my example pages are

index.php?page=quiz

and in my index.php file i have this PHP code :

<?php
$BASE_URL = 'http://www.myurl.com/mymap/';
$FORUMS_URL = 'http://www.myurl.com/mymap/forums';
$DONATE_URL = 'http://www.myurl.com/mymap/donate';
$PROJECTS_URL = 'http://www.myurl.com/mymap/projects';
$QUIZ_URL = 'http://www.myurl.com/mymap/quiz';
if(! get_magic_quotes_gpc() )
{
   $page = addslashes ($_GET['page']);

}
else
{
   $page = $_GET['page'];


}   

if ($page == "pizza")
{
header ('Location:  $FORUMS_URL');

}
elseif ($page == "donate")
{
header ('Location:  $DONATE_URL');
}
elseif ($page == "projects")
{
header ('Location:  $PROJECTS_URL');
}
elseif ($page == "quiz")
{
header ('Location:  $QUIZ_URL');
}
else
{
header ('Location:  $BASE_URL');
}

?>  

I don't get what wrong is with this. The error message said that i already started Header on the row of the page id i am requesting

Please help! Thanks.

Sam
  • 7,252
  • 16
  • 46
  • 65
Mr. Morgan
  • 53
  • 1
  • 6
  • try adding `ob_start();` at the start – blackhawk338 Jun 18 '14 at 14:52
  • @TheRadGamerDan or it gives me a T_STRING error or the T_VARIABLE. and btw i havent asked this question before. He prob just hates me because his answer didnt work on one of my previous question. – Mr. Morgan Jun 18 '14 at 15:00
  • I did also have added the ob_end_flush(); at the end. But still it gives me the same error as the question that John marked as the answer. – Mr. Morgan Jun 18 '14 at 16:04
  • It was marked as a duplicate because the question has been asked several times in the past, before asking, you should search the website to see if you can find an answer for it, because i've seen this question asked a million times in the past and it's been answered a million times – blackhawk338 Jun 21 '14 at 14:30
  • Also, you can't put variables inside single-quoted strings! – Niet the Dark Absol Jun 28 '14 at 09:32
  • Uh, so your code relies on magic quotes? Bad decision. – Gumbo Jun 28 '14 at 09:32

0 Answers0