Hi ive looked and looked but i cant seem to fin the error
<?php
session_start();
header("Cache-control: private");
//$page_title = "Survey Admin: Edit Questions";
include_once("start_page_login.php");
print("<h3>Welcome to the admin page <b>".$_SESSION["login"]."</h3></b><br>\n");
include_once("start_page_admin.php");
include_once("config.php");
include_once("forms.php");
doCSS();
if(isset($_POST["submit"]))
{
// Info has been submitted, check it:
// Check fields are not empty:
# field_validator($field_descr, $field_data, $field_type, $min_length="", $max_length="", $field_required=1) {
field_validator("user_id", $_POST["user_id"], "alphanumeric", 4, 15);
field_validator("first_name", $_POST["first_name"], "string", 4, 35);
field_validator("last_name", $_POST["last_name"], "string", 3,35);
field_validator("faulty_id", $_POST["faulty_id"], "number", 3,7);
field_validator("course_code", $_POST["course_code"], "number", 3,7);
field_validator("current_level", $_POST["current_level"], "number", 1,2);
field_validator("date_started", $_POST["date_started"], "alphanumeric_space", 8,12 );
field_validator("group_id", $_POST["group_id"], "number", 1,3);
field_validator("module_id", $_POST["module_id"], "number", 4,15);
// build query:
$query="SELECT user_id FROM users WHERE user_id='".$_POST["user_id"]."'";
// Run query:
$result=mysql_query($query, $link) or die("MySQL query $query failed. Error if any: ".mysql_error());
// If a row exists with that username, issue an error message:
if( ($row=mysql_fetch_array($result)) )
{
$messages[]="user_id\"".$_POST["user_id"]."\" already exists. Try another.";
}
/*/*
Creating a new user entry in the users table:
If we got here and no error messages were placed in the $messages array above,
then the $user_name that the user provided was valid and we can
continue to create an entry in the users table in the mysql db.
We also effectively 'login' the user and then forward them to the members.php
page using the 'header()' function.
/*/
if(empty($messages))
{
// registration ok, get user id and update db with new info:
new_user_type($_POST["user_id"], $_POST["first_name"], $_POST["last_name"], $_POST["faulty_id"], $_POST["course_code"], $_POST["current_level"], $_POST["date_started"], $_POST["group_id"], $_POST["module_id"]);
}
print subtitle("Current modules");
$result = safe_query("select module_id, description from modules");
while (list($qid,$qtxt) = mysql_fetch_array($result))
{
print anchor_tag("admin_questions.php?what=edit"
."&module_id=$qid"
,$qtxt
);
print "<br>\n";
}
//Check if $message is set, and output it if it is:
?>
<html>
<!-- <title><?php print $title ?></title> -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php doCSS();
if(!empty($messages))
{
displayErrors($messages);
}
?>
<body>
<!-- <h1><?php print $title?></h1>
-->
<form action="<?=$_SERVER["PHP_SELF"]?>" method="POST">
<table>
<tr><td>user_id</td><td><input type="text" name="user_id"
value="<?php print isset($_POST["user_id"]) ? $_POST["user_id"] : "" ;?>"
maxlength="15"></td></tr>
<tr><td>first name: <input type="text" name="first_name" value="" maxlength="35"></td></tr>
<tr><td>last name: <input type="text" name="last_name" value="" maxlength="35"></td></tr>
<tr><td>faulty id: <input type="text" name="faulty_id" value="" maxlength="7"></td></tr>
<tr><td>course_code: <input type="text" name="course_code" value="" maxlength="7"></td></tr>
<tr><td>current_level: <input type="text" name="current_level" value="" maxlength="1"></td></tr>
<tr><td>date_started: <input type="text" name="date_started" value="" maxlength="13"></td></tr>
<tr><td>group_id: <input type="text" name="group_id" value="" maxlength="2"></td></tr>
<tr><td>module_id: <input type="text" name="module_id" value="" maxlength="7"></td></tr>
<tr><td> </td><td><input name="submit" type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"></tr></td>
</table>
</form>
</html>
any help would be much appricated