<?php include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
	

date_default_timezone_set('Asia/Calcutta');
$today = date("Y-m-d");
$time = date("h:i A"); 
$currentyear = date("Y");
	
$querylogin = "select * from  users where username = '". $_SESSION["LOGIN_NAME"]."' AND password = '".$_SESSION["EMPLOYEE_PASSWORD"]."'";
$resultlogin = mysqli_query($conn,$querylogin);
while($row=mysqli_fetch_array($resultlogin))
{
$user_id = $row['user_id'];
$first_name = $row['first_name'];
$login_type=$row['login_type'];
}	
	
// Data to be inserted
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$age = $_POST['age'];
$city = $_POST['city'];
$mobile_no = $_POST['mobile_no'];
$health_issue = $_POST['health_issue'];
$how_to_consult = $_POST['how_to_consult'];
$reference = $_POST['reference'];
$tablename = $_POST['tablename'];





echo $query1 = "insert into  $tablename (first_name,last_name,age,mobile_no,city,how_to_consult,reference,health_issue,entry_by,entry_date,entry_time) values ('$first_name','$last_name','$age','$mobile_no','$city','$how_to_consult','$reference','$health_issue','$user_id','$today','$time')";
//echo $query;
$result=mysqli_query($conn,$query1);

exit();


?><script>
javascript:window.location.href="index.php";
</script>
