 <?php
require_once"labClass.php";
$con=new labClass();
?>
 <div class="container mt-3" style="margin-top:2px;">

 <div  class="mt-4 p-5 bg-white text-dark rounded" >
  <h6>TRANSACTION REGISTRATION FORM:</h6> 
     <sub id="dis"></sub>
    <div class="row">
    <div class="col">  
       <h6>Miamala:</h6>
    <select class="form-control" name="pOpt" id="pOpt">
    <option value="">Select</option> 
    <option value="M-PESA">M-PESA</option>
    <option value="AIRTEL MONEY">AIRTEL MONEY</option>
    <option value="TIGO PESA">TIGO PESA</option>
    <option value="HALO PESA">HALO PESA</option>
    <option value="NMB">NMB</option>
    <option value="CRDB">CRDB</option>  
    </select>
       

     <sup class="text-danger" id="in"> </sup>
   
</div>
 <div class="col">
       <div class="form-floating mb-3 mt-3"> 
        <h6>Amount:</h6>
      <input type="number" style="width:100%; height:40px; border-radius:12px; border-color:white;" id="tPrice" placeholder="Amount:" name="tPrice" required>
       
     <sup class="text-danger" id="q"> </sup>
    </div>
  </div>
<div class="col-sm justify-content-center">

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

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

</div>
 </div>
    
<div id="dispR">
   <?php
  //require_once "nonpurchdebitlist.php";
  ?>
  
</div>
 
 <script>
 

 
 function saveData(){ 
var ecc=0; 
var pOpt =document.getElementById('pOpt').value; 
$.trim(pOpt);
var user =document.getElementById('user').value; 
$.trim(user);
document.getElementById('submit').disabled=true; 
var submit =document.getElementById('submit').value;
var tprice =document.getElementById('tPrice').value; 
var sdate =document.getElementById('sdate').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(tprice==""){ 

         ecc++;
             document.getElementById('q').innerHTML="Amount is required!..";
 

               }
else{

document.getElementById('q').innerHTML="";
    }
     
if(pOpt==""){ 

         ecc++;
             document.getElementById('in').innerHTML="Transaction is required!..";
 

               }
else{

document.getElementById('in').innerHTML="";
    }
  
    if(ecc==0)
    { 
        alert('Your submitted the form!..');
        $.post("miamalaRgfPro.php",
          {submit:submit,user:user,pOpt:pOpt,tprice:tprice,sdate:sdate},
          function(data){
      $('#dis').html(data).show();

    });
    }
  document.getElementById('pOpt').value='';
  document.getElementById('tPrice').value='';
} 
 
 
</script>