Php undefined index error

I had dynamic webpages designed with php and sql. I move my root files from C:\wamp\www\Mentor Mentee System\ to another PC and redo the connection. But, I am having undefined index error in C:\wamp\www\Mentor Mentee System\index.php on line 205. How should I deal with this error?

My scripts as below:


<?php require_once('Connections/connection.php'); ?>
<?php include('Connections/myconnection.php');?>


<?php
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['admin_id'])) {
$loginUsername=$_POST['admin_id'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "student_id";
$MM_redirectLoginSuccess = "manage_student.php?student_id=$loginUsername";
$MM_redirectLoginFailed = "index.php?error=e";
$MM_redirecttoReferrer = true;
mysql_select_db($database_connection, $connection);
    
$LoginRS__query=sprintf("SELECT student_id, student_pass, student_id FROM student WHERE student_id=%s AND student_pass=%s",
GetSQLValueString($loginUsername, "int"), GetSQLValueString($password, "text")); 


$LoginRS = mysql_query($LoginRS__query, $connection) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {


$loginStrGroup = mysql_result($LoginRS,0,'student_id');


//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;     


if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];    
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FENG Mentor Mentee System</title>


<style type="text/css">
</style>


<script type="text/javascript" src="image/swfobject.js"></script>
<script type="text/javascript" src="image/prototype.js"></script>
<script type="text/javascript" src="image/scriptaculous.js"></script>
<script type="text/javascript" src="image/effects.js"></script>
<script type="text/javascript" src="image/lightbox.js"></script>
<link rel="stylesheet" href="image/lightbox.css" type="text/css" media="screen">


<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationPassword.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="image/clogo.PNG" type="image/x-icon"/>


</head>


<body background="image/background.jpg">
<!-- BodyFrame -->
<table width="1250" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">


<!-- Banner -->
<tr>
<td width="1250" height="120" align="center" valign="top" background="image/banner.jpg" bgcolor="#999999"></td>
</tr>
<!-- Banner -->


<!-- TopBorder -->
<tr>
<td height="23" bgcolor="#408080"></td>
</tr>
<!-- TopBorder -->


<!--BodyMenuOut-->
<tr>
<td>
<table width="1250" align="center" valign="top">


    <!--BodyMenuIn-->
    <tr>


        <!--BodyMenuLeft-->
        <td width="410" align="center" valign="top">                            
<table width="420" border="0" cellpadding="0" cellspacing="0">
    <tr>
<td width="420" height="18">
<!--BorderGray-->
<table width="420" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="420" height="23" bgcolor="#999999" style="font-size: 12px"></td>
</tr>
</table>
<!--BorderGray-->
</td>
                <tr><!--XXX-->
<td width="420" align="left" valign="top">
    <form action="<?php echo $loginFormAction; ?>" method="POST" name="frmLogin" id="frmLogin" style="font-size: 12px;">
<table width="420" border="0" align="center" cellpadding="0" cellspacing="0">
                            <!--StudentLecturer-->
<tr>
<td height="32" colspan="4">
<strong>&nbsp;
[<a href="index.php" style="color:#004080; font-size: 13px">Student</a>] 
[<a href="login_lecturer.php" style="color:#004080; font-size: 13px">Lecturer</a>]</strong></td>
        </tr>
                            <!--StudentLecturer-->
                            <!--LoginStudent-->
<tr bgcolor="#408080">
<td height="23" colspan="4"> <strong style="color: #FFF; font-size: 13px;">&nbsp;&nbsp;&nbsp;Login Student</strong></td>
</tr>
                            <!--LoginStudent-->
<tr>
<td height="6" colspan="4"></td>
</tr>
                            <!--UserID-->
<tr bgcolor="#D6F5F5">
<td width="40" height="23"></td>
<td width="75" height="23"><strong style="color: #004080; font-size: 12px;">UserID</strong></td>
<td width="15"><strong style="color: #004080; font-size: 12px;">/strong></td>
<td width="290" style="font-size: 12px">
<span id="sprytextfield1">
<label>
<input style="font-family: Verdana, Geneva, sans-serif; font-size: 11px; color: #009;" name="admin_id" type="text" id="admin_id" size="11" maxlength="100" />
</label>
</span>
</td>
</tr>
                            <!--UserID-->
                            <!--Password-->
<tr bgcolor="#FFFFCC">
<td width="40" height="23"></td>
<td width="75" height="23"><strong style="color: #004080; font-size: 12px;">Password</strong></td>
<td width="15" height="23"><strong style="color: #004080; font-size: 12px;">/strong></td>
<td width="290" style="font-size: 12px">
<span id="sprypassword1">
<label>
<input style="font-family: Verdana, Geneva, sans-serif; font-size: 11px; color: #009;" name="password" type="password" id="password" size="11" maxlength="100" />
</label>
</span>
</td>
</tr>
                            <!--Password-->
<tr>
<td height="6" colspan="4"></td>
</tr>
                            <!--LoginButton-->
<tr>
<td height="21" colspan="3"></td>
<td width="290" height="21">
<label>
    <input type="image" src="image/button_login.gif" name="Login" id="Login" value="Login" />
</label>
</td>
</tr>
                            <!--LoginButton-->
</table>


                        <!--InvalidUser-->
<?php if($_REQUEST['error']==e){?>
<table width="300" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="300" height="5" colspan="2"></td>
</tr>
<tr>
<td width="40" height="3"></td>
<td width="260" height="3" bgcolor="#FFCCCC"></td>
</tr>
<tr>
<td width="40" height="20"></td>
<td width="260" height="20" bgcolor="#FFCCCC" style="color:#C00; text-align:center; font-weight: bold; font-size: 12px;">Invalid UserID or Password !!!</td>
</tr>
<tr>
<td width="40" height="20"></td>
<td width="260" height="20" bgcolor="#FFCCCC" style="color:#C00; text-align:center; font-weight: bold; font-size: 12px;">Please Try Again !!!</td>
</tr>
<tr>
<td width="40" height="3"></td>
<td width="260" height="3" bgcolor="#FFCCCC"></td>
</tr>
</table>
                        <!--InvalidUser-->
                        <?php }?>
    </form>
                    </td>
    </tr>
</table>
        </td>
        <!--BodyMenuLeft-->


        <!--BodyMenuRight-->
        <td width="828" align="center" valign="top">
<table width="818" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#999999">
<td height="23" colspan="3" align="center"><strong style="font-size: 14px; color: #FFF;">Student Session</strong></td>
</tr>
<tr>
<td height="32" colspan="3"></td>
</tr>
<tr bgcolor="#D6F5F5">
<td width="37" rowspan="3"></td>
<td width="744" height="6"></td>
<td width="37" rowspan="3"></td>
</tr>
<tr align="center" bgcolor="#D6F5F5" >
<td width="744"><p class="style32" align="left"><span style="color: #000; font-weight: bold; font-size: 12px;font-weight: bold; color: #004080;">Welcome to Mentor Mentee System - Student Session</span></span>.</p>
<p style="font-size: 12px; text-align: justify; font-weight: normal; color: #004080;">In this session, student's can fully access their own personal information and make necessary amendments when needed.</p>
<p style="font-size: 12px; text-align: justify; font-weight: normal;color: #004080;">At the same time, student's can view their academic information and academic progress along with a bar graph for each academic session that they have completed thus far.</p></td>
</tr>
<tr bgcolor="#D6F5F5">
<td width="744" height="6"></td>
</tr>
<tr>
<td height="32" colspan="3"></td>
</tr>
</table>
        </td>
        <!--BodyMenuRight-->


    </tr>
    <!--BodyMenuIn-->


</table>
</td>
</tr>
<!--BodyMenuOut-->


</table>
<!-- BodyFrame -->


<!-- BottomBorder -->
<table width="1250" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#999999">
<td width="1250" height="23"></td>
    </tr>
<tr bgcolor="#408080">
<td width="1250" height="23"></td>
</tr>
<tr>
<td width="1250" height="6"></td>
</tr>
    <tr>
<td width="1250" height="500" align="center" valign="top" style="font-size: 10px;">
<strong style="font-style: italic; color: #004080; font-weight: bold;">Faculty of Engineering Mentor Mentee</strong>
<strong><a href="login_admin.php" style="font-style: italic; color:#004080; font-weight: bold;">System</a></strong>
<strong style="font-style: italic; color: #004080; font-weight: bold;"> @ Copyright 2011</strong><br />
<strong style="font-style: italic; color: #004080; font-weight: bold;">Designed by Nor Fadzillah Hana Sabtu</strong><br />
<strong style="font-style: italic; color: #004080; font-weight: bold;">Revised by Dr Mohd Saufee Muhammad</strong></td>
</tr>
</table>
<!-- BottomBorder -->


<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprypassword1 = new Spry.Widget.ValidationPassword("sprypassword1");
//-->
</script>
</body>
</html>

Hi and welcome to SitePoint

OK if this is line 205
<?php if($_REQUEST[‘error’]==e){?>

then there could be a couple of errors.
If $_REQUEST[‘error’] has NOT BEEN SET then an error will be displayed
if e is not a function then an error will be displayed.

Try


<?php if(isset($_REQUEST['error']) && ($_REQUEST['error']== 'e')) { ?>


<?php if(isset($_REQUEST['error']) && ($_REQUEST['error']== 'e')) { ?>

Many thanks, it works. =)

I am also having the undefined index error on the line of 311 which I have highlighted it below.


&lt;?php require_once('Connections/connection.php'); ?&gt;
&lt;?php include('Connections/myconnection.php');?&gt;

&lt;?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);

$logoutGoTo = "login_admin.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}

if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
// For security, start by assuming the visitor is NOT authorized. 
$isValid = False; 

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
// Therefore, we know that a user is NOT logged in if that Session variable is blank. 
if (!empty($UserName)) { 
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
// Parse the strings into arrays. 
$arrUsers = Explode(",", $strUsers); 
$arrGroups = Explode(",", $strGroups); 
if (in_array($UserName, $arrUsers)) { 
$isValid = true; 
} 
// Or, you may restrict access to only certain users based on their username. 
if (in_array($UserGroup, $arrGroups)) { 
$isValid = true; 
} 
if (($strUsers == "") && true) { 
$isValid = true; 
} 
} 
return $isValid; 
}

$MM_restrictGoTo = "login_admin.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) &gt; 0) 
//$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo); 
exit;
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
if (PHP_VERSION &lt; 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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST['student_idII'])) && ($_POST['student_idII'] != "")) {
$deleteSQL = sprintf("DELETE FROM student WHERE student_id=%s",
GetSQLValueString($_POST['student_idII'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($deleteSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "updatetranscript")) {
$updateSQL = sprintf("UPDATE transcript SET student_id=%s, course_type=%s, academic_year=%s, transcript_update=%s, course_id=%s, admin_id=%s, grade_id=%s WHERE transcript_id=%s",
GetSQLValueString($_POST['student_id'], "text"),
GetSQLValueString($_POST['course_type'], "text"),
GetSQLValueString($_POST['academic_year'], "text"),
GetSQLValueString($_POST['transcript_update'], "text"),
GetSQLValueString($_POST['course_id'], "text"),
GetSQLValueString($_POST['admin_id'], "text"),
GetSQLValueString($_POST['grade_id'], "text"),
GetSQLValueString($_POST['transcript_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear52")) {
$updateSQL = sprintf("UPDATE student SET ch52=%s, gpa52=%s, cgpa52=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch52'], "text"),
GetSQLValueString($_POST['gpa52'], "text"),
GetSQLValueString($_POST['cgpa52'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear51")) {
$updateSQL = sprintf("UPDATE student SET ch51=%s, gpa51=%s, cgpa51=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch51'], "text"),
GetSQLValueString($_POST['gpa51'], "text"),
GetSQLValueString($_POST['cgpa51'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear42")) {
$updateSQL = sprintf("UPDATE student SET ch42=%s, gpa42=%s, cgpa42=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch42'], "text"),
GetSQLValueString($_POST['gpa42'], "text"),
GetSQLValueString($_POST['cgpa42'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear41")) {
$updateSQL = sprintf("UPDATE student SET ch41=%s, gpa41=%s, cgpa41=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch41'], "text"),
GetSQLValueString($_POST['gpa41'], "text"),
GetSQLValueString($_POST['cgpa41'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear32")) {
$updateSQL = sprintf("UPDATE student SET ch32=%s, gpa32=%s, cgpa32=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch32'], "text"),
GetSQLValueString($_POST['gpa32'], "text"),
GetSQLValueString($_POST['cgpa32'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear31")) {
$updateSQL = sprintf("UPDATE student SET ch31=%s, gpa31=%s, cgpa31=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch31'], "text"),
GetSQLValueString($_POST['gpa31'], "text"),
GetSQLValueString($_POST['cgpa31'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear22")) {
$updateSQL = sprintf("UPDATE student SET ch22=%s, gpa22=%s, cgpa22=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch22'], "text"),
GetSQLValueString($_POST['gpa22'], "text"),
GetSQLValueString($_POST['cgpa22'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear21")) {
$updateSQL = sprintf("UPDATE student SET ch21=%s, gpa21=%s, cgpa21=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch21'], "text"),
GetSQLValueString($_POST['gpa21'], "text"),
GetSQLValueString($_POST['cgpa21'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear12")) {
$updateSQL = sprintf("UPDATE student SET ch12=%s, gpa12=%s, cgpa12=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch12'], "text"),
GetSQLValueString($_POST['gpa12'], "text"),
GetSQLValueString($_POST['cgpa12'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmyear11")) {
$updateSQL = sprintf("UPDATE student SET ch11=%s, gpa11=%s, cgpa11=%s WHERE student_id=%s",
GetSQLValueString($_POST['ch11'], "text"),
GetSQLValueString($_POST['gpa11'], "text"),
GetSQLValueString($_POST['cgpa11'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmaddtranscript")) {
$insertSQL = sprintf("INSERT INTO transcript (student_id, course_type, academic_year, transcript_update, course_id, admin_id, grade_id) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['student_id'], "text"),
GetSQLValueString($_POST['course_type'], "text"),
GetSQLValueString($_POST['academic_year'], "text"),
GetSQLValueString($_POST['transcript_update'], "text"),
GetSQLValueString($_POST['course_id'], "text"),
GetSQLValueString($_POST['admin_id'], "text"),
GetSQLValueString($_POST['grade_id'], "text"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmaddcourse")) {
$insertSQL = sprintf("INSERT INTO course (course_id, admin_id, course_name, course_update) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['course_id'], "text"),
GetSQLValueString($_POST['admin_id'], "text"),
GetSQLValueString($_POST['course_name'], "text"),
GetSQLValueString($_POST['course_update'], "text"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmedituser")) {
$updateSQL = sprintf("UPDATE student SET student_name=%s, student_ic=%s, student_gender=%s, student_race=%s, student_religion=%s, student_address_c=%s, student_email=%s, `year`=%s, year_intake=%s, program=%s, student_contact=%s, student_address=%s, lect_id=%s, medical=%s, medical_name=%s, medical_relation=%s, medical_contact=%s, medical_address=%s, admin_id=%s, admin_update=%s WHERE student_id=%s",
GetSQLValueString($_POST['student_name'], "text"),
GetSQLValueString($_POST['student_ic'], "text"),
GetSQLValueString($_POST['student_gender'], "text"),
GetSQLValueString($_POST['student_race'], "text"),
GetSQLValueString($_POST['student_religion'], "text"),
GetSQLValueString($_POST['student_address_c'], "text"),
GetSQLValueString($_POST['student_email'], "text"),
GetSQLValueString($_POST['year'], "int"),
GetSQLValueString($_POST['year_intake'], "text"),
GetSQLValueString($_POST['program'], "text"),
GetSQLValueString($_POST['student_contact'], "int"),
GetSQLValueString($_POST['student_address'], "text"),
GetSQLValueString($_POST['lect_id'], "text"),
GetSQLValueString($_POST['medical'], "text"),
GetSQLValueString($_POST['medical_name'], "text"),
GetSQLValueString($_POST['medical_relation'], "text"),
GetSQLValueString($_POST['medical_contact'], "text"),
GetSQLValueString($_POST['medical_address'], "text"),
GetSQLValueString($_POST['admin_id'], "text"),
GetSQLValueString($_POST['admin_update'], "text"),
GetSQLValueString($_POST['student_id'], "int"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmaddlect1")) {
$insertSQL = sprintf("INSERT INTO lecturer (lect_id, lect_password, lect_name, lect_register, dept) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['lect_id'], "text"),
GetSQLValueString($_POST['lect_password'], "text"),
GetSQLValueString($_POST['lect_name'], "text"),
GetSQLValueString($_POST['lect_register'], "text"),
GetSQLValueString($_POST['dept'], "text"));

mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
}

mysql_select_db($database_connection, $connection);
$query_lecturer = "SELECT * FROM lecturer WHERE dept='$_REQUEST[dept]'";
$lecturer = mysql_query($query_lecturer, $connection) or die(mysql_error());
$row_lecturer = mysql_fetch_assoc($lecturer);
$totalRows_lecturer = mysql_num_rows($lecturer);

mysql_select_db($database_connection, $connection);
$query_advisor = "SELECT * FROM lecturer WHERE lect_id='$_REQUEST[lect_id]'";
$advisor = mysql_query($query_advisor, $connection) or die(mysql_error());
$row_advisor = mysql_fetch_assoc($advisor);
$totalRows_advisor = mysql_num_rows($advisor);

mysql_select_db($database_connection, $connection);
$query_student = "SELECT * FROM student WHERE lect_id='$_REQUEST[lect_id]' AND year='$_REQUEST[year]'";
$student = mysql_query($query_student, $connection) or die(mysql_error());
$row_student = mysql_fetch_assoc($student);
$totalRows_student = mysql_num_rows($student);

mysql_select_db($database_connection, $connection);
$query_editstudent = "SELECT * FROM student WHERE student_id='$_REQUEST[student_id]'";
$editstudent = mysql_query($query_editstudent, $connection) or die(mysql_error());
$row_editstudent = mysql_fetch_assoc($editstudent);
$totalRows_editstudent = mysql_num_rows($editstudent);

mysql_select_db($database_connection, $connection);
$query_admin = "SELECT * FROM admin WHERE admin_id='$_REQUEST[admin_id]'";
$admin = mysql_query($query_admin, $connection) or die(mysql_error());
$row_admin = mysql_fetch_assoc($admin);
$totalRows_admin = mysql_num_rows($admin);

mysql_select_db($database_connection, $connection);
$query_vstudent = "SELECT * FROM student WHERE student_id='$_REQUEST[student_id]'";
$vstudent = mysql_query($query_vstudent, $connection) or die(mysql_error());
$row_vstudent = mysql_fetch_assoc($vstudent);
$totalRows_vstudent = mysql_num_rows($vstudent);

$maxRows_transcript = 60;
$pageNum_transcript = 0;
if (isset($_GET['pageNum_transcript'])) {
$pageNum_transcript = $_GET['pageNum_transcript'];
}
$startRow_transcript = $pageNum_transcript * $maxRows_transcript;

mysql_select_db($database_connection, $connection);
$query_transcript = "SELECT * FROM transcript WHERE student_id='$_REQUEST[student_id]'";
$query_limit_transcript = sprintf("%s LIMIT %d, %d", $query_transcript, $startRow_transcript, $maxRows_transcript);
$transcript = mysql_query($query_limit_transcript, $connection) or die(mysql_error());
$row_transcript = mysql_fetch_assoc($transcript);

if (isset($_GET['totalRows_transcript'])) {
$totalRows_transcript = $_GET['totalRows_transcript'];
} else {
$all_transcript = mysql_query($query_transcript);
$totalRows_transcript = mysql_num_rows($all_transcript);
}
$totalPages_transcript = ceil($totalRows_transcript/$maxRows_transcript)-1;

$maxRows_course = 500;
$pageNum_course = 0;
if (isset($_GET['pageNum_course'])) {
$pageNum_course = $_GET['pageNum_course'];
}
$startRow_course = $pageNum_course * $maxRows_course;

mysql_select_db($database_connection, $connection);
$query_course = "SELECT * FROM course";
$query_limit_course = sprintf("%s LIMIT %d, %d", $query_course, $startRow_course, $maxRows_course);
$course = mysql_query($query_limit_course, $connection) or die(mysql_error());
$row_course = mysql_fetch_assoc($course);

if (isset($_GET['totalRows_course'])) {
$totalRows_course = $_GET['totalRows_course'];
} else {
$all_course = mysql_query($query_course);
$totalRows_course = mysql_num_rows($all_course);
}
$totalPages_course = ceil($totalRows_course/$maxRows_course)-1;


&lt;input type="hidden" name="MM_update" value="frmyear11" /&gt;
&lt;/form&gt;
&lt;!-- Year 1 - Semester I --&gt;
&lt;!-- Year 1 - Semester II --&gt;
&lt;?php }else if($_REQUEST['edit']==12){ ?&gt;
&lt;form action="&lt;?php echo $editFormAction; ?&gt;" id="frmyear12" name="frmyear12" method="POST"&gt;
&lt;table width="212" border="0" align="center" cellpadding="0" cellspacing="0"&gt;
&lt;tr align="center" bgcolor="#408080"&gt;
&lt;td height="23" colspan="3"&gt;&lt;strong style="color: #FFF; font-size: 13px;"&gt;Year 1 - Semester II&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr bgcolor="#D6F5F5"&gt;
&lt;td width="100" height="22"&gt;&nbsp;&nbsp;&nbsp; Credit Hour&lt;/td&gt;
&lt;td width="12" height="22"&gt;/td&gt;
&lt;td width="100" height="22"&gt;
&lt;strong id="sprytextfield19"&gt;
&lt;label&gt;
&lt;input style="color: #009; font-family: Verdana, Geneva, sans-serif; font-size: 11px;" name="ch12" type="text" id="ch12" value="&lt;?php echo $row_vstudent['ch12']; ?&gt;" size="8" maxlength="2" /&gt;
&lt;/label&gt;
&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr bgcolor="#FFFFCC"&gt;
&lt;td width="100" height="22"&gt;&nbsp;&nbsp;&nbsp; GPA&lt;/td&gt;
&lt;td width="12" height="22"&gt;/td&gt;
&lt;td width="100" height="22"&gt;
&lt;strong id="sprytextfield20"&gt;
&lt;label&gt;
&lt;input style="color: #009; font-family: Verdana, Geneva, sans-serif; font-size: 11px;" name="gpa12" type="text" id="gpa12" value="&lt;?php echo $row_vstudent['gpa12']; ?&gt;" size="8" maxlength="5" /&gt;
&lt;/label&gt;
&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr bgcolor="#D6F5F5"&gt;
&lt;td width="100" height="22"&gt;&nbsp;&nbsp;&nbsp; CGPA&lt;/td&gt;
&lt;td width="12" height="22" align="left"&gt;/td&gt;
&lt;td width="100" height="22"&gt;
&lt;strong id="sprytextfield21"&gt;
&lt;label&gt;
&lt;input style="color: #009; font-family: Verdana, Geneva, sans-serif; font-size: 11px;" name="cgpa12" type="text" id="cgpa12" value="&lt;?php echo $row_vstudent['cgpa12']; ?&gt;" size="8" maxlength="5" /&gt;
&lt;/label&gt;
&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height="3" colspan="3"&gt;
&lt;input name="student_id" type="hidden" id="student_id" value="&lt;?php echo $row_vstudent['student_id']; ?&gt;" /&gt;
&lt;input name="graph" type="hidden" id="graph" value="show" /&gt;
&lt;input name="stu" type="hidden" id="stu" value="student" /&gt;
&lt;input name="lect_id" type="hidden" id="lect_id"

I don’t see any highlighted line. Could you post just line 311 please?

yep and you will keep getting them time and again for each query that tries to use a $_REQUEST variable that HAS NOT BEEN SET.

You have a whole load of queries which will fail

mysql_select_db($database_connection, $connection);
$query_lecturer = "SELECT * FROM lecturer WHERE dept='$_REQUEST[dept]'";
$lecturer = mysql_query($query_lecturer, $connection) or die(mysql_error());
$row_lecturer = mysql_fetch_assoc($lecturer);
$totalRows_lecturer = mysql_num_rows($lecturer);


mysql_select_db($database_connection, $connection);
$query_advisor = "SELECT * FROM lecturer WHERE lect_id='$_REQUEST[lect_id]'";
$advisor = mysql_query($query_advisor, $connection) or die(mysql_error());
$row_advisor = mysql_fetch_assoc($advisor);
$totalRows_advisor = mysql_num_rows($advisor);


mysql_select_db($database_connection, $connection);
$query_student = "SELECT * FROM student WHERE lect_id='$_REQUEST[lect_id]' AND year='$_REQUEST[year]'";
$student = mysql_query($query_student, $connection) or die(mysql_error());
$row_student = mysql_fetch_assoc($student);
$totalRows_student = mysql_num_rows($student);


mysql_select_db($database_connection, $connection);
$query_editstudent = "SELECT * FROM student WHERE student_id='$_REQUEST[student_id]'";
$editstudent = mysql_query($query_editstudent, $connection) or die(mysql_error());
$row_editstudent = mysql_fetch_assoc($editstudent);
$totalRows_editstudent = mysql_num_rows($editstudent);


mysql_select_db($database_connection, $connection);
$query_admin = "SELECT * FROM admin WHERE admin_id='$_REQUEST[admin_id]'";
$admin = mysql_query($query_admin, $connection) or die(mysql_error());
$row_admin = mysql_fetch_assoc($admin);
$totalRows_admin = mysql_num_rows($admin);


mysql_select_db($database_connection, $connection);
$query_vstudent = "SELECT * FROM student WHERE student_id='$_REQUEST[student_id]'";
$vstudent = mysql_query($query_vstudent, $connection) or die(mysql_error());
$row_vstudent = mysql_fetch_assoc($vstudent);
$totalRows_vstudent = mysql_num_rows($vstudent);



All these that use $_REQUEST will fail if the value has not been sent from the form.
You need to check if a variable is there before trying to use it.
See the previous code I gave you.

Also you only need to connect to the database once which I assume you are doing in connections.php

Not to mention that you’re using constants as indexes - PHP is silently throwing a bunch of warnings at you.

Also you should be sanitizing any data that comes from the $_REQUEST array before you let it anywhere near your database (read up about what SQL injection attacks are).

Thanks All. I solved my problem. =)

Hi there, this is another undefined index notice. It says “program” is undefined but I did the same to the “year” and it work fine. Do not know what cause only the “program” to be undefined. See the highlighted line below.

Here the codes:

<label>
<select style=“color: #009; font-family: Verdana, Geneva, sans-serif; font-size: 11px;” name=“year” id=“year”>
<option value=“1” <?php if (!(strcmp(1, $_REQUEST[‘year’]))) {echo “selected=\“selected\””;} ?>>1</option>
<option value=“2” <?php if (!(strcmp(2, $_REQUEST[‘year’]))) {echo “selected=\“selected\””;} ?>>2</option>
<option value=“3” <?php if (!(strcmp(3, $_REQUEST[‘year’]))) {echo “selected=\“selected\””;} ?>>3</option>
<option value=“4” <?php if (!(strcmp(4, $_REQUEST[‘year’]))) {echo “selected=\“selected\””;} ?>>4</option>
<option value=“5” <?php if (!(strcmp(5, $_REQUEST[‘year’]))) {echo “selected=\“selected\””;} ?>>5</option>
<option value=“6” <?php if (!(strcmp(5, $_REQUEST[‘year’]))) {echo “selected=\“selected\””;} ?>>6</option>
</select>
</label>
</strong>
<strong style=“color: #F00; font-size: 10px;”>*</strong>
</td>
<tr bgcolor=“#FFFFCC”>
<td width=“118” height=“22”><strong>   Programme</strong></td>
<td width=“12” height=“22”><strong>:</strong></td>
<td width=“420” height=“22”>
<strong id=“spryselect14”>

<label>
<select style=“color: #009; font-family: Verdana, Geneva, sans-serif; font-size: 11px;” name=“program” id=“program”>
<option value=“Electronic and Computer Engineering” <?php if (!(strcmp(“Electronic and Computer Engineering”, $_REQUEST[‘program’]))) {echo “selected=\“selected\””;} ?>>Electronic and Computer Engineering</option>
<option value=“Electronic and Telecommunication Engineering” <?php if (!(strcmp(“Electronic and Telecommunication Engineering”, $_REQUEST[‘program’]))) {echo “selected=\“selected\””;} ?>>Electronic and Telecommunication Engineering</option>
<option value=“Civil Engineering” <?php if (!(strcmp(“Civil Engineering”, $_REQUEST[‘program’]))) {echo “selected=\“selected\””;} ?>>Civil Engineering</option>
<option value=“Mechanical Engineering” <?php if (!(strcmp(“Mechanical Engineering”, $_REQUEST[‘program’]))) {echo “selected=\“selected\””;} ?>>Mechanical Engineering</option>
<option value=“Chemical Engineering” <?php if (!(strcmp(“Chemical Engineering”, $_REQUEST[‘program’]))) {echo “selected=\“selected\””;} ?>>Chemical Engineering</option>
</select>
</label>

Many thanks to everyone who helped and trying to help. My problems solved for the moment. :slight_smile: