<?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();
      ?> 
 <div class="row">
      <div class="col">
        <small><h6>S/N-MEDICAL TEST</h6></small>
      </div>
       <div class="col">
        <small><h6>TEST PRICE</h6></small>
      </div>
       <div class="col">
        <small><h6>EDIT</h6></small>
      </div>
    </div>

   
  <?php

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

    $testID=$p['testID'];
    
      $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 justify-content-center" >

       <input type="hidden" name="testID<?php echo $cc;?>" id="testID<?php echo $cc;?>" value="<?php echo $p['testID'];?>"/>
    <!--<div class="input-group">
    <span class="input-group-text">-->

      <?php
          echo $cc;
       ?>  
         .<textarea style="height:30px; width:90%;" disabled="true" name="tname<?php echo $cc;?>" id="tname<?php echo $cc;?>"><?php echo $p['mName'];?></textarea><br/>
         
  
  </div>
  

  <div class="col">
        <input type="text" style="width:100%;" disabled="true" name="tPrice<?php echo $cc;?>" id="tPrice<?php echo $cc;?>"  value="<?php echo $p['tPrice'];?>" />
  </div> 
    
  <div class="col">
     <input type="submit"  name="postEdit<?php echo $cc;?>" id="postEdit<?php echo $cc;?>" value="Edit" id="submit" onclick="document.getElementById('tname<?php echo $cc;?>').disabled=false;document.getElementById('tPrice<?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 tname=$('#tname<?php echo $cc;?>').val();var tPrice=$('#tPrice<?php echo $cc;?>').val(); var testID =$('#testID<?php echo $cc;?>').val();if(testID!='' && tPrice!='' && tname!='') {$.post('updateMtestPro.php',{testID:testID,tPrice:tPrice,tname:tname},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});document.getElementById('tname<?php echo $cc;?>').disabled=true;document.getElementById('tPrice<?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;

 
}

         
}


?>