<?php 
 $cc=0;
                                                     //
  require_once "labClass.php";
  
  $con = new labClass();
  
 $chkp= $con->getCodeDiseaseList(); 
    
     
if ($chkp->rowCount()>0) {

  $chp=$chkp->fetchAll();
  ?> 
 <div class="row">
      <div class="col">
        <small><h6>S/N CODE</h6></small>
      </div>
       <div class="col">
        <small><h6>DISEASE</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;
       ?>  
         .<input type="text" style="height:30px; width:90%;" disabled="true" name="code<?php echo $cc;?>" id="code<?php echo $cc;?>" value="<?php echo $p['code'];?>">
            
         
  </div>
  <div class="col">
        <textarea style="width:100%;" disabled="true" name="disease<?php echo $cc;?>" id="disease<?php echo $cc;?>"><?php echo $p['disease'];?></textarea>
  </div>  
  <div class="col">
     <input type="submit"  name="postEdit<?php echo $cc;?>" id="postEdit<?php echo $cc;?>" value="Edit" id="submit" onclick="document.getElementById('code<?php echo $cc;?>').disabled=false;document.getElementById('disease<?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 code=$('#code<?php echo $cc;?>').val(); var disease=$('#disease<?php echo $cc;?>').val(); var recID =$('#recID<?php echo $cc;?>').val(); if(recID!=''  && code!=''  && disease!='') {$.post('codeDiseaseUpdatePro.php',{recID:recID,code:code,disease:disease},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});document.getElementById('code<?php echo $cc;?>').disabled=true;document.getElementById('disease<?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;
}

?>