<?php 
session_start();
include('../includes/dbcon.php');

$str=" ";

$rname= trim($_POST['rname']);

$edate=date("Y-m-d");
$userid=$_SESSION['officesync_id'];


$query=mysqli_query($con," select * from root_master where r_name='$rname'  ")or die(mysqli_error($con));
    $count=mysqli_num_rows($query);
if ($count>0)
{
	echo "<script type='text/javascript'>alert('Exsisting Root!');</script>";
	echo "<script>document.location='admin_root.php'</script>"; 
}

else {

		if ( mysqli_query($con,"INSERT INTO root_master(r_name,r_active) 
			                                 VALUES('$rname',1)  ")or die(mysqli_error($con)))
	        {
					
				//echo "<script type='text/javascript'>alert('Successfully added New Category!');</script>";staff1_id,staff2_id
				echo "<script>document.location='admin_root.php'</script>"; 
	     	 
			}
}		

?>