|
Posted by Glenn O Larsen on 01/11/07 15:50
Jeff skrev:
> Jeff <it_consultant1@hotmail.com.nospam> wrote:
> Any suggestions?
Yes - If you want to send a "header" request, you are not allowed to
send kind of data to the client.
You are sending a bounch of HTML to the client, and then later trying a
"header".
See here:
> ************* complete index.php *********************
> <?php
> session_start();
> if ($_GET["mode"] == "logout") {
> header("Location: index.php");
> }
> ?>
>
Ok, here you start sending data.
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <title>DEMO</title>
[REMOVED MANY LINES]
> <?php
>
> if ($_GET["mode"] == 1)
> include 'search.php';
> else if ($_GET["mode"] == "reg")
> include 'registration.php';
> else if ($_GET["mode"] == "login")
and.. here you load the login.php file, that is trying to send a header
request.
> include('login.php');
> else if ($_GET["mode"] == "logout")
> include ('logout.php');
Your index.php - should be aomething like:
************* index.php *******************
<?php
session_start();
if ($_GET["mode"] == "logout") {
header("Location: index.php");
return;
} else if ($_GET["mode"] == 1)
include 'search.php';
// return ??
else if ($_GET["mode"] == "reg")
include 'registration.php';
// return ??
else if ($_GET["mode"] == "login")
include('login.php');
return;
else if ($_GET["mode"] == "logout")
include ('logout.php');
return;
else if ($_GET["mode"] == "profile")
include 'profile.php';
// return ??
else
include 'home.php';
?>
Your HTML code...
**********************************************
Remeber to do a "return" on the "include" files that is sending a header.
You should also use "switch" insted of "if / else if / else if"!
Good luck!
--
Glenn O Larsen
Navigation:
[Reply to this message]
|