<?php
require'includes/head2.php';

	if(isset($_POST['add']))
	{	
		require '../connections/conn.php';
		
		
		$n=$_POST['p_name'];
		$d=$_POST['p_date'];
		$p=1;
		$st=1;
		$get_id="select `p_id` from `patient` where `p_name`='$n'";
		$get_id_res = $conn->query($get_id);
		$row=mysqli_fetch_array($get_id_res);
		$p_id=$row['p_id'];
		
			
				 $insert_country="insert into `appointment`(`p_id`,`date`,`payment`,`status`)VALUES('$p_id','$d','$p','$st')";
				$result = $conn->query($insert_country);
				
				echo "<script type='text/javascript'>window.location.href = 'home.php'</script>";
			
		
	}
?>


	<form action="" method="POST" enctype="multipart/form-data">
		<input style="font-size:20pt;width:12em; background-color:#ffffff; border-style:none" type="text" name="p_name" placeholder="Name" id="tag" required><br><br>
		<input style="font-size:20pt;width:12em; background-color:#ffffff; border-style:none" type="date" name="p_date" placeholder="Date" required><br><br>
		<input type="submit" name="add" value="ADD"style="font-size:20pt;width:12em; background-color:#000000; color:#ffffff; border-style:none">
	</form>

<?php
require 'includes/foot.php';?>