Its just that the way I had everything set up to display within a div, when a new page was being echoed, it would place it outside this div. I managed to get something which works, but outputting a javascript message box, and when they click ok, I redirect them back to the main page.
I have one new issue I just noticed. On my main page, the page where I do most of the html code (Basically a template page), I have
<script type="text/javascript" src="Validate.js"></script>
Now in my php file where I handle the log in, I have a form which gets echoed out. This calls up the Validate.js onsubmit.
In the same page, I also have another function which process the form, so gets the values out, compares them to values in the database etc. One of the jobs here is to see whether an option had been made on the form, and if it has, set some cookies.
if(isset($_POST['remember'])){
setcookie("cookname", $_SESSION['username'], time()+60*60*24*100, "/");
setcookie("cookpass", $_SESSION['password'], time()+60*60*24*100, "/");
}
I now get the common error
Warning: Cannot modify header information - headers already sent by
Its complaining that the script type code has already sent the header. However, I need to have this in the head of my main document as this is where it goes. Now if I do this, how can I then set the cookies? Is there anyway around this?
cheers
Just to give you an idea, this is how i call everything up
<?php
session_start();
include("LoginForm.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>L Page</title>
<link href="css/RegStyles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="JSValidate.js"></script>
</head>
<body>
<div id="container">
<div id="leftBar">
<ul>
<li><a href="#">A</a></li>
<li><a href="#">B</a></li>
<li><a href="#">C</a></li>
<li><a href="#">D</a></li>
</ul>
</div>
<div id="centerBar">
<?php
displayStatus();
?>
</div>
<div id="rightBar"></div>
</div>
</body>
</html>
So the outcome of all processes I make goes into the centerBar div.