<?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']);
$Q37 = mysqli_real_escape_string($link, $_POST['Q37']);
$Q37comment = mysqli_real_escape_string($link, $_POST['Q37comment']);
$Q37AI = mysqli_real_escape_string($link, $_POST['Q37AI']);
$Q38 = mysqli_real_escape_string($link, $_POST['Q38']);
$Q38comment = mysqli_real_escape_string($link, $_POST['Q38comment']);
$Q38AI = mysqli_real_escape_string($link, $_POST['Q38AI']);
$Q39 = mysqli_real_escape_string($link, $_POST['Q39']);
$Q39comment = mysqli_real_escape_string($link, $_POST['Q39comment']);
$Q39AI = mysqli_real_escape_string($link, $_POST['Q39AI']);
$Q40 = mysqli_real_escape_string($link, $_POST['Q40']);
$Q40comment = mysqli_real_escape_string($link, $_POST['Q40comment']);
$Q40AI = mysqli_real_escape_string($link, $_POST['Q40AI']);
$Q41 = mysqli_real_escape_string($link, $_POST['Q41']);
$Q41comment = mysqli_real_escape_string($link, $_POST['Q41comment']);
$Q41AI = mysqli_real_escape_string($link, $_POST['Q41AI']);
$refQ37 = mysqli_real_escape_string($link, $_POST['refQ37']);
$refQ38 = mysqli_real_escape_string($link, $_POST['refQ38']);
$refQ39 = mysqli_real_escape_string($link, $_POST['refQ39']);
$refQ40 = mysqli_real_escape_string($link, $_POST['refQ40']);
$refQ41 = mysqli_real_escape_string($link, $_POST['refQ41']);

// attempt insert query execution
$sql = "UPDATE dossierform SET Q37 = '$Q37',Q37comment = '$Q37comment',Q37AI = '$Q37AI',Q38 = '$Q38',Q38comment = '$Q38comment',Q38AI = '$Q38AI',Q39 = '$Q39',Q39comment = '$Q39comment',Q39AI = '$Q39AI',Q40 = '$Q40',Q40comment = '$Q40comment',Q40AI = '$Q40AI',Q41 = '$Q41',Q41comment = '$Q41comment',Q41AI = '$Q41AI',refQ37 = '$refQ37',refQ38 = '$refQ38',refQ39 = '$refQ39',refQ40 = '$refQ40',refQ41 = '$refQ41' WHERE idvac='$idvac' AND Assess='$Assess'";
	
mysqli_query($link, $sql);

//mysqli_query($link, $sql3);

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