Can anyone please tell me why I get this error....
Warning: Cannot modify header information - headers already sent by (output started at /home/ittechni/public_html/register.php:10) in /home/ittechni/public_html/register.php on line 78
...with the code below?
I've been trying to work it out for days, but I can't! The code works fine outside of the HTML but not within the HTML.
<?php
include ("dbConfig.php");
?>
<meta http-equiv="Content-Language" content="en-gb">
<title>ITCOMEDY.COM</title>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
width="621" id="AutoNumber1">
<tr>
<td width="621" colspan="5"><?php
virtual('title.htm');
?></td>
</tr>
<tr>
<td width="467" colspan="3" rowspan="5" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
width="100%" id="AutoNumber3" height="7">
<tr>
<td width="100%" colspan="3" height="12"><font size="1"> </font></td>
</tr>
<tr>
<td width="100%" colspan="3" height="19">
<img border="0" src="images/profile.jpg"></td>
</tr>
<tr>
<td width="33%" height="1"></td>
<td width="33%" height="1"></td>
<td width="34%" height="1"></td>
</tr>
<tr>
<td width="100%" height="19" colspan="3">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" width="100%" id="AutoNumber4" height="1">
<tr>
<td width="1%" height="1"><font size="2"> </font></td>
<td width="33%" height="1"><font face="Verdana" size="2"> </font></td>
<td width="1%" height="1"><font size="2"> </font></td>
<td width="68%" height="1"><font face="Verdana" size="2"> </font></td>
</tr>
<tr>
<td width="103%" height="1" colspan="4"><font face=verdana size=2><?php
if ( $_GET["op"] == "reg" )
{
$bInputFlag = false;
foreach ( $_POST as $field )
{
if ($field == "")
{
$bInputFlag = false;
}
else
{
$bInputFlag = true;
}
}
// If we had problems with the input, exit with error
if ($bInputFlag == false)
{
die( "Problem with your registration info. "
."Please go back and try again.");
}
// Fields are clear, add user to database
// Setup query
$q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) "
."VALUES ('".$_POST["username"]."', "
."PASSWORD('".$_POST["password"]."'), "
."'".$_POST["email"]."')";
// Run query
$r = mysql_query($q);
// Make sure query inserted user successfully
if ( !mysql_insert_id() )
{
die("Error: User not added to database.");
}
else
{
// Redirect to thank you page.
Header("Location: register.php?op=thanks");
}
} // end if
// ==== Thank you page ====================================================
//
// ========================================================================
elseif ( $_GET["op"] == "thanks" )
{
echo "<h2><font face=verdana size=2>Thanks for registering!</h2>";
}
// ==== Main Form =========================================================
//
// ========================================================================
else
{
echo "<form action=\"?op=reg\" method=\"POST\">\n";
echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n";
echo "Password: <input type=\"password\" name=\"password\"
MAXLENGTH=\"16\"><br />\n";
echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br><br />\n";
echo "<input type=\"submit\" value=\"Register\">\n";
echo "</form>\n";
}
// EOF
?></td>
</tr>
<tr>
<td width="15%" height="1"><font size="1"> </font></td>
<td width="18%" height="1"><font size="1"> </font></td>
<td width="14%" height="1"><font size="1"> </font></td>
<td width="53%" height="1"><font size="1"> </font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="8"> </td>
<td width="146" rowspan="5" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
width="100%" id="AutoNumber2">
<tr>
<td width="100%"><font size="1"> </font></td>
</tr>
<tr>
<td width="100%"><img border="0" src="images/latestposts.jpg"></td>
</tr>
<tr>
<td width="100%"><font size="2"> </font></td>
</tr>
<tr>
<td width="100%"><?php
include ("dbConfig.php");
mysql_select_db("ittechni_main");
$count=0;
$result = mysql_query("SELECT * FROM posts ORDER BY id DESC");
while ($count <= 10){
$myrow = mysql_fetch_row($result);
printf("<font face=verdana size=1><a href=\"full_view.php?id=%s\">%s</a><br><br>\n",
$myrow[0], $myrow[2], $myrow[1]);
$count++;
}
?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="8"> </td>
</tr>
<tr>
<td width="8"> </td>
</tr>
<tr>
<td width="8"> </td>
</tr>
<tr>
<td width="8"> </td>
</tr>
<tr>
<td width="621" colspan="5">
<img border="0" src="images/bottombar.jpg"></td>
</tr>
<tr>
<td width="125"> </td>
<td width="124"> </td>
<td width="218"> </td>
<td width="8"> </td>
<td width="146"> </td>
</tr>
<tr>
<td width="621" colspan="5"><font face="Verdana">
<p align="center"><font size="1">ITComedy.com (c) 2003
<a href="mailto:Dave@itcomedy.com">Dave</a> all rights reserved. <br>
Any and all trademarks acknowledged.</font></font></td>
</tr>
</table>
</center>
</div>