<?php
if(isset($_POST["tname"]) && isset($_POST["tPrice"]) && isset($_POST["patientID"]))

{

	 $tname= $_POST['tname'];

	 $tPrice=$_POST['tPrice'];   
 
   echo $regdate=Date("Y-m-d"); 

   $patientID= $_POST['patientID'];                                                     //CHECKING ENDS HERE

    $st ="Not yet";
    $rDescrip="Not yet";  
    $checkingStatus="Not yet";  
    $pAge=0;  
    $checkedBy="Not yet"; 
    $postedBy="Not yet";
    $pStatus ="Not yet";
    require_once"labClass.php";
    $con=new labClass(); 

    $rQ= $con->getThisPatientD($patientID); 
    //print_r($rQ);
    if($rQ->rowCount()>0)
          {

                $pD= $rQ->fetch();
                $pD['dob'];
                $pAge= date('Y',strtotime($regdate))-date('Y',strtotime($pD['dob']));





             $Q= $con->addMedicalTest($patientID,$tname,$st,$rDescrip,$checkingStatus,$pAge,$checkedBy,$postedBy,$tPrice,$pStatus); 
            
             if($Q->rowCount()>0)
                {


                ?>
                <small><h6 class="text-success">Successfull added!..</h6></small>
                <?php
                }
                else
                {
                print_r($Q);
                 
                }
              
                

               }else{
                 ?>
                <small><h6 class="text-danger">Invalid patient id!..</h6></small>
                <?php
               }
   
  
}
 

?>