<?php session_start();?>

<?php
	if($_SESSION ["role"]=="Administrator")
	{
		$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"];
		}
?>
<?php

require ("_common/global.php");
require ("_common/conn.php");
//require ("_common/function.php");
require ("_common/check_session.php");
?>
<?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());
//}

//test mysql
$link = mysql_connect("localhost","dvsvigov_vacc","DVSvacdos123");
if (!$link)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("dvsvigov_vacdos", $link);

// Escape user inputs for security
// $fName = mysqli_real_escape_string($link, $_POST['fName']);
//$tradename = mysqli_real_escape_string ($link, $_POST['tradename']);
//$manufacturername = mysqli_real_escape_string($link, $_POST['manufacturername']);
//$locagentadd = mysqli_real_escape_string($link, $_POST['locagentadd']);
//$loacagentphone = mysqli_real_escape_string($link, $_POST['loacagentphone']);

//$plantaff = mysqli_real_escape_string($link, $_POST['$plantaff']);
//$mainplant = mysqli_real_escape_string($link, $_POST['$mainplant']);
//$vacctype = mysqli_real_escape_string($link, $_POST['$vacctype']);
//$dateaddtask = mysqli_real_escape_string($link, $_POST['$dateaddtask']);
//$addedby = mysqli_real_escape_string($link, $_POST['$addedby']);
//$statusform = mysqli_real_escape_string($link, $_POST['$statusform']);
//$statusassign = mysqli_real_escape_string($link, $_POST['$statusassign']);

    $name = $_POST['name'];
   
    $notes = $_POST['notes'];
// attempt insert query execution
$sql = "INSERT INTO data_asian (name, notes) 
VALUES ('$name', '$notes')";
//testsql
if (!mysql_query($sql,$link))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";
header('location: pre-asian.php');
mysql_close($link)

//mysqli_query($link, $sql);
//header('location: assignevaluator.php');
//mysqli_close($link);
?>
