Log in script not working -- data insert does

I have a login page, in which the data base is connected and PHP and MYSQL are both running. A data insert page on the same site to the same connection is working fine. But the Login page isn’t parsing. I provide either correct or incorrect username and password and submit, andit flashes and stays on the page. Here is the code on the page:

<?php require_once('Connections/TKTV.php'); ?> <?php ini_set ('display_errors', 1);error_reporting (E_ALL & ~E_NOTICE); if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['user id'])) { $loginUsername=$_POST['user id']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "welcome.php"; $MM_redirectLoginFailed = "oops.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_TKTV, $TKTV); $LoginRS__query=sprintf("SELECT `user id`, password FROM tktv_login2 WHERE `user id`=%s AND password=%s", GetSQLValueString($loginUsername, "-1"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $TKTV) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?>

Here is the form code



      <input name="password" type="text" id="password" value="Password" />
      <br />
      <br />
Please use your KiltCorp web site log-in credentials for entry here as well.
Sponsor our Newsletter | Privacy Policy | Terms of Service