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

{
  $searchValue= $_POST['searchValue'];
      
  require_once "labClass.php";
  
  $con = new labClass();
  
 $chkp= $con->getThisConsultant($searchValue); 
    
     
if ($chkp->rowCount()>0) {

  $chp=$chkp->fetchAll();
  ?> 
 <div class="row">
      <div class="col">
        <small><h6>S/N-Category</h6></small>
      </div>
       <div class="col">
        <small><h6>NHIF PRICE</h6></small>
      </div>
      <div class="col">
        <small><h6>CASH PRICE</h6></small>
      </div>
      <div class="col">
        <small><h6>EDIT</h6></small>
      </div>
        
        
    </div>

   
  <?php

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

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


 <div class="row">
      
     <div class="col">
       <sup id="rdn<?php echo $cc;?>" class="text-danger" ></sup>
     </div>
   </div> 
  <div class="row">
  
 
  
   <div class="col" >

       <input type="hidden" name="recID<?php echo $cc;?>" id="recID<?php echo $cc;?>" value="<?php echo $p['recID'];?>"/>
     

      <?php
          echo $cc;
       ?>  
         .<textarea style="height:30px; width:90%;" disabled="true" name="cDr<?php echo $cc;?>" id="cDr<?php echo $cc;?>"><?php echo $p['drCategory'];?>
           </textarea>
         
  </div>
  <div class="col">
        <input type="number" style="width:100%;" disabled="true" name="nhifP<?php echo $cc;?>" id="nhifP<?php echo $cc;?>"  value="<?php echo $p['nhifPrice'];?>" />
  </div> 

   <div class="col">
        <input type="number" style="width:100%;" disabled="true" name="cashP<?php echo $cc;?>" id="cashP<?php echo $cc;?>"  value="<?php echo $p['cashPrice'];?>" />
  </div> 
    
  <div class="col">
     <input type="submit"  name="postEdit<?php echo $cc;?>" id="postEdit<?php echo $cc;?>" value="Edit" id="submit" onclick="document.getElementById('cDr<?php echo $cc;?>').disabled=false;document.getElementById('nhifP<?php echo $cc;?>').disabled=false;document.getElementById('cashP<?php echo $cc;?>').disabled=false;$('#postEdit<?php echo $cc;?>').hide();$('#postUpdate<?php echo $cc;?>').show();" />


        <input type="submit" style="display:none;" name="postUpdate<?php echo $cc;?>" id="postUpdate<?php echo $cc;?>"value="Update" id="submit" onclick="  var cDr=$('#cDr<?php echo $cc;?>').val(); var cashP=$('#cashP<?php echo $cc;?>').val();var nhifP =$('#nhifP<?php echo $cc;?>').val();var recID =$('#recID<?php echo $cc;?>').val(); if(recID!=''  && cashP!=''  &&nhifP!=''  && cDr!='') {$.post('consultantUpdatePro.php',{recID:recID,nhifP:nhifP,cashP:cashP,cDr:cDr},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});document.getElementById('cDr<?php echo $cc;?>').disabled=true;document.getElementById('nhifP<?php echo $cc;?>').disabled=true;document.getElementById('cashP<?php echo $cc;?>').disabled=true;$('#postUpdate<?php echo $cc;?>').hide();$('#postEdit<?php echo $cc;?>').show();} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide item detail required!..';}" />
  </div>
</div> 
 <?php
}
  $cc=0;
}
}
?>