  <?php
 require_once"labClass.php";
  $con=new labClass();

 // $row=$con->getRowCount();                                                                //FUNCTION FOR VISITORS OF HOTEL HERE
  //$nr=$row->rowCount()+1;
///
?>
 
 <table width="100%">
 
  AGENT REGISTRATION FORM: 
 
 
  <tr>
  <td>
   Name:
      <input type="text"  id="fname" value="" style="background-color:white;border-radius:12px; height:35px; width:100%;" placeholder="Name" name="fname" required>
       
      <sup class="text-danger" id="nf"></sup>
    </td>
    <td>   
    Region:
      <input type="text" id="region" value="" placeholder="Region" style="background-color:white;height:35px;border-radius:12px; width:100%;" name="region" required>
       
      <sup class="text-danger" id="re"> </sup>
     
  </td>
    <td>   
    District:
      <input type="text" id="district" value="" placeholder="District" style="background-color:white;height:35px;border-radius:12px; width:100%;" name="district" required>
       
      <sup class="text-danger" id="di"> </sup>
     
  </td>
  </tr>   
<tr>
    <td>   
    Ward:
      <input type="text" id="ward" value="" placeholder="Ward" style="background-color:white;height:35px;border-radius:12px; width:100%;" name="ward" required>
       
      <sup class="text-danger" id="wa"> </sup>
     
  </td>
     <td>    
    Street: 
      <input type="text" style="background-color:white;border-radius:12px;height:35px; width:100%;" id="street" value="" width="30%" placeholder="Street" name="street" required>
      <sup class="text-danger" id="st"> </sup>
  </td>
<td> 
    Phone number: 
   <input type="number" style="background-color:white;border-radius:12px; width:100%;height:35px;" value="" id="phoneno" placeholder="Phone number" name="phoneno" required>
      <sup class="text-danger" id="p"> </sup>
     </td>
 
  </tr> 
  <tr>
   
   <td colspan="3" align="right">

  <input type="submit" class="btn btn-primary" id="submit" name="submit" style="height:40PX;" onclick="saveEData();" value="Submit"/>    
   </td>

    </tr>   
 </table>
 <?php
 require_once "pharmAgentEdtLPO.php";
 ?>
<script>
//$(document).ready(function(){
  
//$("#pr").on('submit',function(e){
function saveEData(){ 
var ecc=0; 
var fname =document.getElementById('fname').value; 
$.trim(fname);
var submit =document.getElementById('submit').value; 
//var tin =document.getElementById('tin').value;
var region =document.getElementById('region').value;
$.trim(region);
var district =document.getElementById('district').value;
$.trim(district); 
var ward =document.getElementById('ward').value;
$.trim(ward);
var street =document.getElementById('street').value;
$.trim(street);
var phoneno =document.getElementById('phoneno').value;
$.trim(phoneno);
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(street=="")
{ 
ecc++;

document.getElementById('st').innerHTML="Street required!..";
 }
else{

document.getElementById('st').innerHTML="";

   }
if(region=="")
{ 
ecc++;

document.getElementById('re').innerHTML="Region required!..";
 }
else{

document.getElementById('re').innerHTML="";

   }
if(district=="")
{ 
ecc++;

document.getElementById('di').innerHTML="District required!..";
 }
else{

document.getElementById('di').innerHTML="";

   }

if(fname=="")
{ 
ecc++;

document.getElementById('nf').innerHTML="Name required!..";
 }
else{

document.getElementById('nf').innerHTML="";

   }
  j=0, i=0;                                
 
if(ward==""){ 

 ecc++;
document.getElementById('wa').innerHTML="Ward is required!..";
 }
 else{

 document.getElementById('wa').innerHTML="";
   }
 
    j=0, i=0; 

var phn =/[\(0-9)]{12}/;
   
if(phoneno==""){
//e.preventDefault();
ecc++;
document.getElementById('p').innerHTML="Phone is required valid one!..";
 
 
              }
 else{ 
       
       
  

       if(phoneno.length >12 || phoneno.length < 10)
         {
 
        //e.preventDefault();
        ecc++;
        document.getElementById('p').innerHTML="Valid phone number must contain either 10 or 12 digits.."; 
              

         }

         else
         {

        document.getElementById('p').innerHTML="";

        }
   }
 
    j=0, i=0; 
    /// GENGER VALIDATION
 
                                                                   // 
  //alert("password:"+password+",email:"+email+",dhired:"+dhired+",depart:"+depart+",fname:"+fname+"mname:"+mname+",lname:"+lname+",phoneno:"+phoneno+",address:"+address+",occupation:"+occupation+",country:"+country+",gender:"+gender+",dob:"+dob);
    if(ecc==0)
    {
      //alert("Error found:"+ecc);
        $.post("pharmAgentRgProLPO.php",
          {submit:submit,fname:fname,ward:ward,region:region,district:district,street:street,phoneno:phoneno},
          function(data){
      $('#disp').html(data).show();

    });
    }


 
//}
//);
//}
}
//);

</script>