I might just be cross eyed. I'm using PHP 4.3.4. Even though there is a header in the If statement it goes on to complete the rest of the PHP page. If I place a "break;" after the first header line it works. In previous pages I've written as soon as a header was found the rest of the page was not completed(executed)....or at least I think that was the behavior. Any suggestions as to why although it goes to redirect the page to instructors.php that it still querys the database and completes the commands? Shouldn't it just stop at the if statement?
<?
session_start();
$length = strlen($_POST[newcoursenumber]);
if($length != 12){
header("Location:instructors.php?error=coursenum");
}
$db_name = "none";
$table_name = "none";
$connection = @mysql_connect("localhost","none","none") or die("Couldn't Connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database.");
$result =mysql_query("SELECT coursenum from co298012004f WHERE email='$_SESSION[username]'") or die (mysql_error());
$coursenums = mysql_fetch_array($result);
$newvar = $_POST[newcoursenumber].':'.$coursenums[0];
mysql_query("UPDATE co298012004f SET coursenum='$newvar' where email='$_SESSION[username]'") or die (mysql_error());
header("Location:instructors.php");
?>