Search
$value){
if ($arr[$key] == $val){
unset($arr[$key]);
}
}
return $arr = array_values($arr);
}
$code=$_POST["id"];
$year=$_POST["year"];
$studenttype=$_POST["studenttype"];
$value = $code."|".$year."|".$studenttype;
$val = $_COOKIE["subject"];
$values = explode(",",$val);
$values = remove_element($values, $value);
$val = implode(",",$values);
echo $val;
setcookie(subject,$val, time()+3600);
Header("Location:search.php");
}
?>
Search Results";
$studenttype = $_POST["studenttype"];
switch ($studenttype) {
case 'ug_dom_full_fee':
$tablename = "UG Domestic full-fee";
break;
case 'ug_csp_fee':
$tablename = "UG Domestic CSP";
break;
case 'subject':
$tablename = "Single-subject";
break;
case 'pg_dom_fee_help_full_fee':
$tablename = "PG Domestic FEE-HELP and full fee";
break;
}
$subject = $_POST["subject"];
$subjectarray = explode(" / ",$subject);
$subjectcode = $subjectarray[1];
$course = $_POST["course"];
$coursearray = explode(" / ",$course);
$coursecode = $coursearray[1];
if($subjectcode != null) { $code = $subjectcode; $table = "subject"; }
if($coursecode != null) { $code = $coursecode; $table = "course"; }
$yearcommenced = $_POST["yearcommenced"];
//include("config.php");
$db = mysql_connect($databasehost, $databaseusername, $databasepassword);
if(!$db) { // Show error if we cannot connect.
echo 'ERROR: Could not connect to the database.';
exit();
}
mysql_select_db($databasename);
///////Get columns from the table and then get the data
$sql = "SELECT * FROM $table;";
$result = mysql_query($sql);
$i = 0;
while($i
name;
if($i!=4) $table_append_head = $table_append_head."".str_replace("_"," ",$fields[$i])." | ";
$i++;
}
$query_det = "SELECT * FROM $table WHERE $fields[0] = '$code'";
$result_det = mysql_query($query_det);
$i=0;
while($i".$f_val[$i]."";
if($table == "subject" and $i==0) $add_link = " | ";
$i++;
}
//////////
////Get the first column of the selected table////
$query = "SHOW COLUMNS FROM $studenttype";
$qColumnNames = mysql_query($query) or die("mysql error");
$numColumns = mysql_num_rows($qColumnNames);
$colname = mysql_fetch_row($qColumnNames);
$firstcol = $colname[0];
///////////////////////////////////////
$query = "SELECT * FROM $studenttype WHERE $firstcol = '$code'";
//echo $query;
$result = mysql_query($query);
$fee = mysql_result($result,0,$yearcommenced);
if($subjectcode != null){
echo "";
echo $table_append_head;
if($studenttype != "subject") {
echo "Year Commenced | ";
}
echo "Fee | ";
echo "Student Type | ";
echo "ADD | ";
echo "
";
echo "";
echo $table_append_data;
if($studenttype != "subject") {
echo "".str_replace("_"," ",$yearcommenced)." | ";
echo "".$fee." | ";
}
echo "".$tablename." | ";
echo $add_link;
echo "
";
}
if($coursecode != null){
$actual_fee=$fee*$f_val[2];
echo "";
echo $table_append_head;
echo "Year Commenced | ";
echo "Student Type | ";
echo "1 EFTSL Fee | ";
echo "Actual Price | ";
echo "
";
echo $table_append_data;
echo "".$tablename." | ";
echo "".str_replace("_"," ",$yearcommenced)." | ";
echo "$".$fee." | ";
echo "$".$actual_fee." |
";
}
}
///Display the shopping cart//////
$cart_data = $_COOKIE["subject"];
if($cart_data != null){
echo "Cart
";
//include("config.php");
$db = mysql_connect($databasehost, $databaseusername, $databasepassword);
if(!$db) { // Show error if we cannot connect.
echo 'ERROR: Could not connect to the database.';
exit();
}
mysql_select_db($databasename);
$table="subject";
$sql = "SELECT * FROM $table;";
$result = mysql_query($sql);
$i = 0;
while($iname;
if($i!=4) $table_append_head_cookie = $table_append_head_cookie."".str_replace("_"," ",$fields[$i])." | ";
$i++;
}
echo "";
echo $table_append_head_cookie;
echo "Student Type | ";
echo "Year Commenced | ";
echo "Fee | ";
echo "Remove | ";
echo "
";
$data=explode(",",$cart_data);
$count=0;
while($count < count($data))
{
$data_record = explode("|",$data[$count]);
$code = $data_record[0];
$yearcommenced = $data_record[1];
$studenttype = $data_record[2];
switch ($studenttype) {
case 'ug_dom_full_fee':
$tablename = "UG Domestic full-fee";
break;
case 'ug_csp_fee':
$tablename = "UG Domestic CSP";
break;
case 'subject':
$tablename = "Single-subject";
break;
case 'pg_dom_fee_help_full_fee':
$tablename = "PG Domestic FEE-HELP and full fee";
break;
}
$query_det = "SELECT * FROM $table WHERE $fields[0] = '$code'";
$result_det = mysql_query($query_det);
$i=0;
while($i".$f_val[$i]."";
$add_link = " | ";
$i++;
}
////Get the first column of the selected table////
$qColumnNames = mysql_query("SHOW COLUMNS FROM $studenttype") or die("mysql error");
$colname = mysql_fetch_row($qColumnNames);
$firstcol = $colname[0];
///////////////////////////////////////
$result = mysql_query("SELECT * FROM $studenttype WHERE $firstcol = '$code'");
$fee = mysql_result($result,0,$yearcommenced);
if($fee==null) $fee=$fee_single_subject;
$totalfee = $fee+$totalfee;
if($yearcommenced==null) $yearcommenced="NA";
echo "";
echo $table_append_data_cookie;
echo "".$tablename." | ";
echo "".str_replace("_"," ",$yearcommenced)." | ";
echo "$".$fee." | ";
echo $add_link;
echo "
";
$count++;
$table_append_data_cookie=null;
}
echo "
";
echo "Total fee: $".$totalfee."
";
}
//////////////////////////////////
?>