I am working on a registration and login form for my website and have reached the point where I can submit the data, insert it into the database, and validate it. I can't seem to get the users to the proper pages after the information has been checked. I have tried the "header" statement to no avail. I am using "if---else" to validate. Here is my script for validation:
<html>
<body>
<?php
$con = mysql_connect("localhost","colescom_colen","****** *");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("colescom_names", $con);
$result = mysql_query("SELECT * FROM person
WHERE name='Colen'");
while($row = mysql_fetch_array($result))
$name=$row['name'];
$email=$row['email'];
if ($name=="Colen")
header("Location: ThankYou.html");
else
header("Location: NoRecord.html");
echo "<br />";
?>
</body>
<html>
When I run the script, I get this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/colescom/public_html/where.php:3) in /home/colescom/public_html/where.php on line 16
I have used "echo" statements in place of the "header" statements to let me know whether the information in the database matches. That works. Any help would be greatly appreciated.
Anyone who wishes to study php or mysql should check out this website:
<html>
<body>
<?php
$con = mysql_connect("localhost","colescom_colen","****** *");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("colescom_names", $con);
$result = mysql_query("SELECT * FROM person
WHERE name='Colen'");
while($row = mysql_fetch_array($result))
$name=$row['name'];
$email=$row['email'];
if ($name=="Colen")
header("Location: ThankYou.html");
else
header("Location: NoRecord.html");
echo "<br />";
?>
</body>
<html>
When I run the script, I get this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/colescom/public_html/where.php:3) in /home/colescom/public_html/where.php on line 16
I have used "echo" statements in place of the "header" statements to let me know whether the information in the database matches. That works. Any help would be greatly appreciated.
Anyone who wishes to study php or mysql should check out this website:
Comment