<?php
  $cc=0;
 
if(isset($_POST["searchValue"]))

{

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

  require_once"labClass.php";

  $con=new labClass();

  $rQ= $con->getMtestBySearch($searchValue);

               //print_r($rQ);
  if ($rQ->rowCount()>0) {

    $chp=$rQ->fetchAll();
      ?> 
 <table class="table">
    <thead>
      <th>
        <small><h6>S/N</h6></small>
      </th>
      <th>
        <small><h6>MEDICAL TEST</h6></small>
      </th>
       <th>
        <small><h6>TEST PRICE</h6></small>
      </th>
       <th>
        <small><h6>SEND</h6></small>
      </th>
    </thead>

   
  <?php

 foreach ($chp as $key => $p) {

    $testID=$p['testID'];
    
      $cc++; 
     
        ?>


 <tr>
      
     <td colspan="4">
       <sup id="rdn<?php echo $cc;?>" class="text-danger" ></sup>
     </td>
     
  </tr>
  
 
  
   <tr>
 <td width="3%">
       <input type="hidden" name="testID<?php echo $cc;?>" id="testID<?php echo $cc;?>" value="<?php echo $p['testID'];?>"/>
     
   
      <?php
          echo $cc;
       ?>  
    </td>
     <td width="70%"> 
      <textarea style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="tname<?php echo $cc;?>" id="tname<?php echo $cc;?>"><?php echo $p['mName'];?></textarea>
   </td> 
  

  <td> 
        <input type="text" style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="tPrice<?php echo $cc;?>" id="tPrice<?php echo $cc;?>"  value="<?php echo $p['tPrice'];?>" />
  </td>  
    
  <td> 
    

        <input type="submit" name="postUpdate<?php echo $cc;?>" id="postUpdate<?php echo $cc;?>"value="SEND" id="submit" onclick="  var tname=$('#tname<?php echo $cc;?>').val();var tPrice=$('#tPrice<?php echo $cc;?>').val(); var patientID =$('#pID').val();if(patientID!='' && tPrice!='' && tname!='') {alert(tPrice+tname+patientID); $.post('sendMedicalTPro.php',{patientID:patientID,tPrice:tPrice,tname:tname},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='The problem occured, make sure you entered patient ID!..';}" />
  </td> 
    
     
 </tr> 
  <?php
}

  $cc=0;
?>
</table>
  <?php
}        
}
?>