Jump to content

Recommended Posts

it depends on how you've got your code set up. i don't know where your redirect is placed. you're linking me to ?page=contact, so your redirect would have to be within the content of the contact page. plus, you've got to make sure that any headers you're passing come before [b]any[/b] HTML is output to the browser
<?php

session_start();
     
header("Location: http://www.randomhomepage.co.uk/index/index.php?page=faq");

?>

that is my contact.php page

<?

session_start();

if(!isset($page))$page="home";

switch($page)
{
 
case "account":$file="files/account.php";
break;

case "contact":$file="files/contact.php";
break;

case "home":$file="files/home.php";
break;

case "faq":$file="files/faq.php";
break;

case "statistics":$file="files/statistics.php";
break;

case "test":$file="files/test.php";
break;

}

?>

thats my pages.php page
somehow, you have to be including you contact.php into your index.php. your link you gave us is to a file index.php?page=contact, right? so, somewhere in index.php, you have to be including the content of contact.php in order for that code to be executed.
<?php

session_start();

include('include/include.php');
include('include/hits.php');

$page = $_GET['page'];

if($page == "")
{
 
header("location: http://www.randomhomepage.co.uk/index/index.php?page=home");

}
else
{
if($page == "home")
{

include($file);

}
elseif($page == "test")
{
 
include($file);

}
else
{
 
echo"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional dtd'>";

echo"<html xmlns='http://www.w3.org/1999/xhtml'>";

echo"<head>";
echo"<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />";
echo"<title>$config_website</title>";
echo"<link href='$config_website_url/include/style/style.css' rel='stylesheet' type='text/css' />";
include ('include/scripts.php');
echo"</head>";

echo"<body bgcolor='#ffffff'>";

echo"<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo" <tr>
      <td>";
        include ('header.php');
echo"  </td>
      </tr>";
echo" <tr>
      <td>";
        include ('logo.php');
echo"  </td>
      </tr>";
echo" <tr>
      <td>";
        include ('navigation.php');
echo"  </td>
      </tr>";
echo" <tr>
      <td>";
        include($file);
echo"  </td>
      </tr>";
echo" <tr>
      <td>";
        include ('footer.php');
echo"  </td>
      </tr>";
echo"</table>";

echo"</body>";

echo"</html>";

}

}

?>

thats my index page....
ok, and since 'contact' doesn't fit any of the first conditions, it's trying to be included in the middle of the HTML, right? on this line:
[code]
<?php
echo "<tr><td>";
include($file);
echo "</td></tr>";
?>
[/code]

is that right? if so, it's not working because you're trying to send header information AFTER HTML is being output like i mentioned above.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.