 <?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>Register excess money here:</h6> 
     <sub id="dis"></sub>
    <div class="row">
    <div class="col">
       <div class="form-floating mb-3 mt-3"> 
        <h6>Description:</h6>
      <input type="text" style="width:100%; height:40px; border-radius:12px; border-color:white;" id="descrip" placeholder="Description:" name="descrip" required>
       
     <sup class="text-danger" id="q"> </sup>
    </div>
     <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 "excessmoneyentryR.php";
  ?>
  
</div>
 
 <script>
 

 
 function saveData(){ 
var ecc=0; 
var descrip =document.getElementById('descrip').value; 
$.trim(descrip);
var user =document.getElementById('user').value; 
$.trim(user);
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(descrip==""){ 

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

               }
else{

document.getElementById('in').innerHTML="";
    }
  
    if(ecc==0)
    { 
        $.post("excessmoneypro.php",
          {submit:submit,user:user,descrip:descrip,tprice:tprice,sdate:sdate},
          function(data){
      $('#dis').html(data).show();

    });
    }

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