<html>
<body>
<?
require("DB.php");
require("asstHeader.php");

//print session_encode();
$studentID = $event_id;
$db = new DB("cs425", "Andromeda*");
$link = $db->connect();

$student = $db->getStudent($studentID);
//if(isset($actionflag) && ($actionflag == "Update")){
if($submit){	
	$obj = new Student;
	$obj->rNumber = $form[rNumber];
	$obj->name->firstName = $form[firstName];
	$obj->name->lastName = $form[lastName];
	$obj->cGPA = $form[cGPA];
	$obj->gre->verbal = $form[GRE];

print $obj->name->firstName;

	//use the proper rNumber for database function
	//in case if it has changed.
	$db->updateStudent($obj, $form[rNumber]);
	$student = $db->getStudent($form[rNumber]);
	print $student["firstName"];
	print $student["verbal"];
}
?>
		
<h1>Student</h1>
<table border = 1>
<!--<form action="display.php"">-->
<!--<form action="<?php print $PHP_SELF;?>">-->
<form method = post>
<input type = "hidden" name="actionflag" value="Update">
<tr><td>R Number</td>
<td><input type="text" name="form[rNumber]" value="<? print $student[rNumber]?>"></td>
<tr><td>First Name</td>
<td><input type="text" name="form[firstName]" value="<? print $student->name->firstName?>"></td>
<tr><td>Last Name</td>
<td><input type="text" name="form[lastName]" value="<? print $student->name->lastName?>"></td>
<tr><td>Cummulative GPA</td>
<td><input type="text" name="form[cGPA]" value="<? print $student->cGPA?>"></td>
<tr><td>GRE</td>
<td><input type="text" name="form[GRE]" value="<? print $student->gre->verbal?>"></td>
<tr><td><input type="Submit" name="submit" value=" Update "></td>
</form></table>
</body></html>

