<?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']);

$Q21=0;
$Q21comment=0;
$Q21AI=0;
$refQ21=0;
$Q24=0;
$Q24comment=0;
$Q24AI=0;
$refQ24=0;

$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']);
$Q20 = mysqli_real_escape_string($link, $_POST['Q20']);
$Q20comment = mysqli_real_escape_string($link, $_POST['Q20comment']);
$Q20AI = mysqli_real_escape_string($link, $_POST['Q20AI']);
//$Q21 = mysqli_real_escape_string($link, $_POST['Q21']);
if (isset($_POST['Q21'])) $Q21=$_POST['Q21'];
//$Q21comment = mysqli_real_escape_string($link, $_POST['Q21comment']);
if (isset($_POST['Q21comment'])) $Q21comment=$_POST['Q21comment'];
//$Q21AI = mysqli_real_escape_string($link, $_POST['Q21AI']);
if (isset($_POST['Q21AI'])) $Q21AI=$_POST['Q21AI'];
$Q22 = mysqli_real_escape_string($link, $_POST['Q22']);
$Q22comment = mysqli_real_escape_string($link, $_POST['Q22comment']);
$Q22AI = mysqli_real_escape_string($link, $_POST['Q22AI']);
$Q23 = mysqli_real_escape_string($link, $_POST['Q23']);
$Q23comment = mysqli_real_escape_string($link, $_POST['Q23comment']);
$Q23AI = mysqli_real_escape_string($link, $_POST['Q23AI']);
//$Q24 = mysqli_real_escape_string($link, $_POST['Q24']);
if (isset($_POST['Q24'])) $Q24=$_POST['Q24'];
//$Q24comment = mysqli_real_escape_string($link, $_POST['Q24comment']);
if (isset($_POST['Q24comment'])) $Q24comment=$_POST['Q24comment'];
//$Q24AI = mysqli_real_escape_string($link, $_POST['Q24AI']);
if (isset($_POST['Q24AI'])) $Q24AI=$_POST['Q24AI'];
$Q25 = mysqli_real_escape_string($link, $_POST['Q25']);
$Q25comment = mysqli_real_escape_string($link, $_POST['Q25comment']);
$Q25AI = mysqli_real_escape_string($link, $_POST['Q25AI']);
$Q26 = mysqli_real_escape_string($link, $_POST['Q26']);
$Q26comment = mysqli_real_escape_string($link, $_POST['Q26comment']);
$Q26AI = mysqli_real_escape_string($link, $_POST['Q26AI']);
$Q27 = mysqli_real_escape_string($link, $_POST['Q27']);
$Q27comment = mysqli_real_escape_string($link, $_POST['Q27comment']);
$Q27AI = mysqli_real_escape_string($link, $_POST['Q27AI']);
$refQ20 = mysqli_real_escape_string($link, $_POST['refQ20']);
//$refQ21 = mysqli_real_escape_string($link, $_POST['refQ21']);
if (isset($_POST['refQ21'])) $refQ21=$_POST['refQ21'];
$refQ22 = mysqli_real_escape_string($link, $_POST['refQ22']);
$refQ23 = mysqli_real_escape_string($link, $_POST['refQ23']);
//$refQ24 = mysqli_real_escape_string($link, $_POST['refQ24']);
if (isset($_POST['refQ24'])) $refQ24=$_POST['refQ24'];
$refQ25 = mysqli_real_escape_string($link, $_POST['refQ25']);
$refQ26 = mysqli_real_escape_string($link, $_POST['refQ26']);
$refQ27 = mysqli_real_escape_string($link, $_POST['refQ27']);


// attempt insert query execution
$sql = "UPDATE  dossierform SET Q20 = '$Q20',Q20comment = '$Q20comment',Q20AI = '$Q20AI',Q21 = '$Q21',Q21comment = '$Q21comment',Q21AI = '$Q21AI',Q22 = '$Q22',Q22comment = '$Q22comment',Q22AI = '$Q22AI',Q23 = '$Q23',Q23comment = '$Q23comment',Q23AI = '$Q23AI',Q24 = '$Q24',Q24comment = '$Q24comment',Q24AI = '$Q24AI',Q25 = '$Q25',Q25comment = '$Q25comment',Q25AI = '$Q25AI',Q26 = '$Q26',Q26comment = '$Q26comment',Q26AI = '$Q26AI',Q27 = '$Q27',Q27comment = '$Q27comment',Q27AI = '$Q27AI',refQ20 = '$refQ20',refQ21 = '$refQ21',refQ22 = '$refQ22',refQ23 = '$refQ23',refQ24 = '$refQ24',refQ25 = '$refQ25',refQ26 = '$refQ26',refQ27 = '$refQ27' WHERE idvac='$idvac' AND Assess='$Assess'";
	
mysqli_query($link, $sql);

//mysqli_query($link, $sql3);


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