<?php
require_once"labClass.php";
$con=new labClass();
$patientID= $_POST['patientID'];
$pn= $con->getThisPatientD($patientID);
if($pn->rowCount()>0){
$n=$pn->fetch();
?> 
    <small>PATIENT NAME:<h6 class="text-primary"><?php echo $n['fname']." ". $n['mname']." ".$n['lname'];?></h6></small> 
 <div class="container mt-3" style="width:100%;">

 <div  class="mt-4 p-5 bg-white text-dark rounded">
  <h6>Enter vital sign here:</h6> 
     <div id="dispco"></div>
    <div class="row">
    <div class="col-xl" >
    <div class="form-floating mb-3 mt-3" style="width:100%;"> 
      <select class="form-select" id="vital" name="vital">
      
      <option value="">Select</option>
      <option value="Weight">Weight</option>

      <option value="Temperature">Temperature</option> 

      <option value="Pressure">Pressure</option>

      <option value="Pulse">Pulse</option>
    </select>  
      <sup class="text-danger" id="de"> </sup>
    </div>
</div>
 <div class="col">
       <div class="form-floating mb-3 mt-3"> 
      <input type="text" class="form-control"   id="unit" placeholder="Unit" name="unit" required>
       <label for="unit">Unit:</label>
     <sup class="text-danger" id="co"> </sup>
 </div>
</div> 
<div class="col">

  <div class="form-floating mb-3 mt-3"> 
  <button type="submit" class="btn btn-primary" id="submit" value="Submit" name="submit"  style="height:60px;" onclick="saveData()">Submit</button>

</div>
</div>
</div>
 

<!-- SEARCH BOX END-->

</div>

 </div>
 
 <?php
   }

   else {
     echo "Invalid patientID!..";
        }
   ?>
   
 
 
 <script>

  function submision(){
    var searchValue=$('#tname').val();
    $('#dispR').empty();
    $.post('codeDiseaseBySeach.php',{searchValue:searchValue},function(data){
      $('#dispR').html(data);

    });
  }
 

 
function saveData(){ 
var ecc=0; 
var unit =document.getElementById('unit').value; 
$.trim(unit);
var sdate =document.getElementById('sdate').value; 
$.trim(sdate);
var user =document.getElementById('user').value; 
$.trim(unit);
var patientID =document.getElementById('pID').value; 
$.trim(patientID);
var vital =document.getElementById('vital').value; 
$.trim(vital);
var submit =document.getElementById('submit').value;  
  
var vN =/[\(A-Za-z)]/g; 

var nV =/[a-z\s]/i;
  var j=0,k=0, g=0,i=0;
  //FIRST NAME VALIDATION
  
if(unit==""){ 
         ecc++;
      document.getElementById('co').innerHTML="Unit is required!..";
           }
else{
document.getElementById('co').innerHTML="";
    }
    if(patientID==""){ 
         ecc++;
      alert("Unit is required!..");
           }
 
   if(vital==""){ 
   ecc++;
   document.getElementById('de').innerHTML="vital is required!.";
               }
else{

document.getElementById('de').innerHTML="";
    }  
if(ecc==0)
    { 
    $.post("vitalSignPro.php",
    {submit:submit,patientID:patientID,user:user,sdate:sdate,unit:unit,vital:vital},
          function(data){
      $('#dispco').html(data).show();
    });
    document.getElementById('unit').value=""; 
    document.getElementById('vital').value="";
    }
} 
</script>
  