<?php session_start();?>

<?php
	if($_SESSION ["role"]=="Evaluator")
	{
		$role = $_SESSION["role"];
		$email = $_SESSION["email"];
		// header('location:form.php');
	}
	else
	{
		header('location:index.php?expired session please login back');
		// $userName = $_SESSION["userName"]; $userRole = $_SESSION["userRole"];
		}
		
require ("../_common/global.php");
require ("../_common/conn.php");
//require ("_common/function.php");
require ("../_common/check_session.php");
?>
<?php

	$conn = mysql_connect('localhost', 'dvsvigov_vacc', 'DVSvacdos123');
	 if (!$conn)
    {
	 die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("dvsvigov_vacdos", $conn);
$result = mysql_query("SELECT * FROM user WHERE email  = '$email'");
$test = mysql_fetch_array($result);
if (!$result)
		{
		die("Error: Data not found..");
		}
				$Assess=$test['name'] ;
				
							
mysql_close($conn);

?>
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "dvsvigov_vacc", "DVSvacdos123", "dvsvigov_vacdos");
 
// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
// $fName = mysqli_real_escape_string($link, $_POST['fName']);
$idvac = mysqli_real_escape_string ($link, $_POST['idvac']);
//$vacctype = mysqli_real_escape_string ($link, $_POST['vacctype']);
$Assess = mysqli_real_escape_string($link, $_POST['Assess']);
//$datesubmit = mysqli_real_escape_string($link, $_POST['datesubmit']);
$Q4 = mysqli_real_escape_string($link, $_POST['Q4']);
$Q4comment = mysqli_real_escape_string($link, $_POST['Q4comment']);
$Q4AI = mysqli_real_escape_string($link, $_POST['Q4AI']);
$Q5 = mysqli_real_escape_string($link, $_POST['Q5']);
$Q5comment = mysqli_real_escape_string($link, $_POST['Q5comment']);
$Q5AI = mysqli_real_escape_string($link, $_POST['Q5AI']);
$Q6 = mysqli_real_escape_string($link, $_POST['Q6']);
$Q6comment = mysqli_real_escape_string($link, $_POST['Q6comment']);
$Q6AI = mysqli_real_escape_string($link, $_POST['Q6AI']);
$refQ4 = mysqli_real_escape_string($link, $_POST['refQ4']);
$refQ5 = mysqli_real_escape_string($link, $_POST['refQ5']);
$refQ6 = mysqli_real_escape_string($link, $_POST['refQ6']);

// attempt insert query execution
$sql = "UPDATE dossierform SET Q4 = '$Q4',Q4comment = '$Q4comment',Q4AI = '$Q4AI',Q5 = '$Q5', Q5comment = '$Q5comment',Q5AI = '$Q5AI',Q6 = '$Q6',Q6comment = '$Q6comment',Q6AI = '$Q6AI',refQ4 = '$refQ4',refQ5 = '$refQ5',refQ6 = '$refQ6' WHERE idvac='$idvac' AND Assess='$Assess'";
	
mysqli_query($link, $sql);

//mysqli_query($link, $sql3);


header('location: documents.php?idvac='.$idvac.'');
mysqli_close($link);
?>
