 <?php 
   /* if(isset($_POST['post']))

  {

     if(   isset($_POST['admin']))
     {

        //$hnm=$_POST['hiD'];
        //$ownID=$_POST['owniD']; 
        // require_once("../buda_connect.php");
        // $con = new connect_class();
        // $HD=$con->getMyOperationHotel($ownID,$hnm);
    
       // if($HD->rowCount()>0)
        {
         // $ro=$HD->fetch();

        }
     // $myH=$con->getMyHotel($ownID);
     // if ($myH->rowCount()>0) 
         {
        // $my=$myH->fetch();
         }
    }   
  } 

 
  
 */
    
?> 
<center> 
 
  <!--NEW USER REGISTRATION FORM, DISPLAYED BY DEFAULTS IN PAGE LOAD-->
 <ul>
         <li>
             <form action="housesForRent.php" method="post">
 
 

                              <input class="hi" type="hidden" name="admin"  value="<?php echo $admin;?>">

                              <input class="pos" type="submit" value="House for rent" name="post"  >
               </form>
         </li>
          <li style="padding-right:5%;">
             <form action="houseRegFormPro.php" method="post">
 
 

                              <input class="hi" type="hidden" name="admin"  value="<?php echo $admin;?>">

                              <input class="pos" type="submit" value="New houses" name="post"  >
               </form>
         </li>
       </ul>

<fieldset id="alt_new_user_reg_form">
<label id="reg_form_tile_label">House for rent registration form: </label></p/>
<i>Please enter profile information below-</i>
<form name="new_user_registration" id="new_user_registration" action="houseRegFormPro.php"  method="post">

<table border="0" id="reg_form_table">

<!--<tr>                      <!--CARRY HOTEL ID AND ROOM ID- 
 <!--CARRY HOTEL ID AND ROOM ID--

        <input class="h" type="hidden" name="owniD"  value="<?php //echo $ownID;?>">-->

        <input class="hi" type="text" name="admin"  value="<?php echo $admin;?>"> 

        

                                                      <!--USERS NAME-->
                                                     
                                                                             <!--CONTACT ADDRESS-->



<tr>


<td height="40px" valign="top">  </td> 


<td height="40px" valign="top"> </td>


<td height="40px" valign="top"><label id="mini_label">Owner id:<sup>*</sup></label>
<br><sup id="ow"></sup>
     <input type="text" name="ownerid" id="ownerid" class="prof_info" value="<?php echo $ownerid;?>"/><br/>
    
</td></tr>



<tr>

<tr> <td colspan="3" id="reg_form_table_cell" valign="bottom">

<label id="main_label"  >Contact Address:</label>
 
</td>
</tr>
<tr>
<td height="40px" valign="top"> <label id="mini_label">House name (Title):<sup>*</sup></label><br>
<sup id="hn"></sup></td> 
<td height="40px" valign="top"> <label>E-mail<sup>*</sup></label><br><sup id="em"></sup></td>
<td height="40px" valign="top"><label id="mini_label">Phone Number<sup>*</sup></label>
<br><sup id="p"></sup></td></tr>
<tr>
     
      <td>
     
     <input type="text" name="hname" id="hname" class="prof_info" value="<?php echo $hname;?>"/><br/>
    

     </td>


     <td id="reg_form_table_cell">
    
    
     <input type="email" name="email" id="email" class="prof_info" value="<?php echo $email; ?>" /><br/>
    
    
    </td>
     <td id="reg_form_table_cell">
     
     <input type="text" name="phoneno" id="phoneno" class="prof_info"  value="<?php echo $phoneno;?>" /><br/>
     
     </td>

     
</tr>




<td height="40px" valign="top"> <label id="mini_label">Category:<sup>*</sup></label><br>

<sup id="cat"></sup></td> 


<td height="40px" valign="top"> <label>No of rooms:<sup>*</sup></label><br><sup id="rmn"></sup></td>


<td height="40px" valign="top"><label id="mini_label"> Contract duration:<sup>*</sup></label>
<br><sup id="cdr"></sup></td></tr>



<tr>
     
      <td>
     
     <select name="category" id="category" class="prof_info" >
<option value="">select</option>
<option value="Self contain">Self contain</option>
<option value="None self">None self</option>

      <br/>
    

     </td>


     <td id="reg_form_table_cell">
    
    
     <input type="number" name="rnumber" id="rnumber" class="prof_info" /><br/>
    
    
    </td>
     <td id="reg_form_table_cell">
     
     <input type="text" name="cduration" id="cduration" class="prof_info" value="<?php echo $cduration;?>"  /><br/>
     
     </td>

     
</tr>


                               <!---USERS PLACE OF BIRTH-->


<tr>
<td colspan="3" id="reg_form_table_cell" valign="bottom">

<label id="main_label">Place/location:</label> 
  
  </td>

</tr>
<tr>
   <td height="40px" valign="top"> <label id="mini_label">House number:<sup>optional</sup></label><br/></td>

   <td height="40px" valign="top">  <label id="mini_label">Street/Village<sup>*</sup></label><br><sup id="vs"></sup></td>

   <td height="40px" valign="top">   <label id="mini_label">Ward<sup>*</sup></label><br><sup id="w"></sup> </td>

</tr>




<tr><td id="reg_form_table_cell">

        <input type="text" name="hnumber" id="hnumber" class="prof_info" value="<?php echo $hnumber;?>"/><br/>
       
    </td>
    <td id="reg_form_table_cell">

    
        <input type="text" name="street" id="street" class="prof_info" value="<?php echo  $street;?>"   /><br/>
        
    </td>

    <td id="reg_form_table_cell">

    
        <input type="text" name="ward" id="ward" class="prof_info"  value="<?php echo  $ward;?>" /><br/>
      
    </td>
</tr>
    

<tr>
   <td height="40px" valign="top"> <label id="mini_label">Town/District<sup>*</sup></label> <br><sup id="ds"></sup></td>


   <td height="40px" valign="top">    <label id="mini_label">City/Region<sup>*</sup></label> <br><sup id="r"></sup></td>


   <td height="40px" valign="top"> <label id="mini_label">Country<sup>*</sup></label><br><sup id="c"></sup> </td>

</tr>



    <tr>


    <td id="reg_form_table_cell">
       
 <input type="text" name="district" id="district" class="prof_info" value="<?php echo $district;?>"  /><br/>
         
    </td>
    <td id="reg_form_table_cell">

   
        <input type="text" name="region" id="region" class="prof_info" value="<?php echo $region;?>"  /><br/>
      
    </td>

    <td id="reg_form_table_cell">

    
        <input type="text" name="country" id="country" class="prof_info" value="<?php echo  $country;?>"/><br/>
        
    </td>
</tr>
<tr>

         <td  id="reg_form_table_cell" > 

          <label id="mini_label">Distance from main road:</label><br><sup id="drm"></sup> 
        
        <input type="text" name="distancerm" id="distancerm" class="prof_info" value="<?php echo $distancerm;?>" />
</td>
<td   id="reg_form_table_cell" > 

          <label id="mini_label">Cost:</label><br><sup id="hc"></sup> <input type="text" name="hcost" id="hcost"  class="prof_info" value="<?php echo $hcost;?>" />  

           
        
</td>


<td   id="reg_form_table_cell" > 

         <label id="mini_label">Currency:</label><br><sup id="cc"></sup> 

        <input type="text" name="currency" id="currency" class="prof_info" value="<?php echo $currency;?>" />    
        
        

           
  
</td>
</tr>
<tr>
  <td height="50px" colspan="3">
    
    <label id="mini_label">Term and condition:</label><br><sup id="tcond"></sup> <br>
    <textarea name="tcondition" id="tcondition" style="height:35px; width:100%;" ><?php echo $tcondition;?></textarea>
  </td>
 </tr>
 <tr>
  <td height="50px" colspan="3">
    
    <label id="mini_label">Finishing description:</label><br><sup id="fnd"></sup> <br>
    <textarea name="finishD" id="finishD" style="height:35px; width:100%;" ><?php echo $finishD;?></textarea>
  </td>
 </tr>
<tr>

         <td colspan="3" height="50px" > 

           <label id="mini_label">The nearest popular place name:</label><br><sup id="o"></sup> <br>
        
        <textarea name="popularDistination" id="popularDistination"  style="height:35px; width:100%;"><?php echo  $popularDistination;?></textarea>

        <p/>

       <center><input type="submit"  name="post" value="Submit" id="subownreg"/></center> 
          
        </td>
  </tr>





<!----PLACE OF BIRTH, AND PROFILE GENDER 

 -->



 

 </table>
 
</form>
</fieldset>

 

<script>
$(document).ready(function(){
  
$("#new_user_registration").on('submit',function(e){
//  e.preventDefault()
 
var street =document.getElementById('street').value;
$.trim(street);

var distancerm =document.getElementById('distancerm').value;
$.trim(distancerm);
var hcost =document.getElementById('hcost').value;
$.trim(hcost);

var email =document.getElementById('email').value;
$.trim(email);
var ward =document.getElementById('ward').value;
$.trim(ward);
var district =document.getElementById('district').value;
$.trim(district);
var region =document.getElementById('region').value;
$.trim(region);
var category =document.getElementById('category').value;
$.trim(category);
var cduration =document.getElementById('cduration').value;
$.trim(cduration);
var rnumber =document.getElementById('rnumber').value;
$.trim(rnumber);
var finishD =document.getElementById('finishD').value;
$.trim(finishD);

var tcondition =document.getElementById('tcondition').value;
$.trim(tcondition);

var currency =document.getElementById('currency').value;
$.trim(currency);


var country =document.getElementById('country').value;
$.trim(country);

var country =document.getElementById('country').value;
$.trim(country);

var ownerid =document.getElementById('ownerid').value;
$.trim(ownerid);
 
var phoneno =document.getElementById('phoneno').value;
$.trim(phoneno);
var popularDistination =document.getElementById('popularDistination').value;
$.trim(popularDistination);
var hname =document.getElementById('hname').value;
$.trim(hname);
 


var vN =/[\(A-Za-z)]/g; 

var NN =/[\(A-Za-z0-9)]/g;
var nV =/[a-z\s]/i;
  var j=0,k=0, g=0,i=0;

  ////////////                         /////////////////
  //////////////////TERM AND CONDITION/////////////////////
  ////////////////////////////////////////////////////////
    ////////////
  ////////////OWNER ID//////////////////
  ///////////////////////////////////////
  if(tcondition==""){
 e.preventDefault();

   document.getElementById('tcond').innerHTML="Term and id required!..";
 

 }
  
  else{
 
        document.getElementById('tcond').innerHTML="";

     
   }
 
    j=0, i=0;

                                                         //FIRST NAME VALIDATION
 
  /////////////////////////////////////////////////
  //////////////////////////////////////////////
  /////////////////////////////
  ////////////OWNER ID//////////////////
  ///////////////////////////////////////
  if(ownerid==""){
 e.preventDefault();

   document.getElementById('ow').innerHTML="Owner id required!..";
 

 }
 else{

      for(i=0;i<ownerid.length;i++)
       {
         if(!ownerid[i].match(NN))
          {
             j++;

           }
        }
      
       if(j>0){
       e.preventDefault();
   
        document.getElementById('ow').innerHTML="Invalid id"; 
              }
         else{
 
        document.getElementById('ow').innerHTML="";

              }
   }
 
    j=0, i=0;

                                                         //FIRST NAME VALIDATION
 
// e.preventDefault();




 
                                                                            ///STREET VALIDATION
 

if(street==""){
 e.preventDefault();

document.getElementById('vs').innerHTML="Street is required!..";
 

 }
 else{

      for(i=0;i<street.length;i++)
       {
         if(!street[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
       e.preventDefault();
   
        document.getElementById('vs').innerHTML="Invalid name"; 
              }
         else{
 
        document.getElementById('vs').innerHTML="";

              }
   }
 
    j=0, i=0;
               
                         //CATEGORY
if(category==""){
 e.preventDefault();

   document.getElementById('cat').innerHTML="Category is required!..";
 

 }
 else{

      for(i=0;i<category.length;i++)
       {
         if(!category[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
       e.preventDefault();
   
        document.getElementById('cat').innerHTML="Invalid name"; 
              }
         else{
 
        document.getElementById('cat').innerHTML="";

              }
   }
 
    j=0, i=0;




              
   ///////////////CONTRACT DURATION 



   if(cduration==""){
 e.preventDefault();

   document.getElementById('cdr').innerHTML="Contract duration required!..";
 

 }
 else{
 
         
 
        document.getElementById('cdr').innerHTML="";

              
   }
 
    j=0, i=0;


                                                    //EMAIL VALIDATION


 
var mail=/[\(A-Za-z)][\w.]\w+@\w+\.(net|com|edu)/;
if(email==""){
 e.preventDefault();
document.getElementById('em').innerHTML="E-mail address is required!..";
 

             }
 else{
  
         if(!email.match(mail))
          {
          
        e.preventDefault();
        document.getElementById('em').innerHTML="Invalid email"; 
              }
         else{ 
        document.getElementById('em').innerHTML="";

              }
   }
 



 /////DISTANCE FROM  MAIN ROAD



 if(distancerm==""){
e.preventDefault();
document.getElementById('drm').innerHTML="Distance is required!..";
 

           }
  else{
  
        document.getElementById('drm').innerHTML="";

            
   }
 
    j=0, i=0;

        //TERM AND CONDITION DESCRIPTION DESCRIPTION


 if(finishD==""){
e.preventDefault();
document.getElementById('fnd').innerHTML="Finishing description required!..";
 

           }
  else{
  
        document.getElementById('fnd').innerHTML="";

             
   }
 
    j=0, i=0;
   


    //FINISHING DESCRIPTION


 if(finishD==""){
e.preventDefault();
document.getElementById('fnd').innerHTML="Finishing description required!..";
 

           }
  else{
  
        document.getElementById('fnd').innerHTML="";

             
   }
 
    j=0, i=0;
   
   
            
  


                                                                            ///WARD VALIDATION

if(ward==""){
e.preventDefault();
document.getElementById('w').innerHTML="Ward is required!..";
 

           }
  else{
 for(i=0;i<ward.length;i++)
       {
         if(!ward[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
        e.preventDefault();
        document.getElementById('w').innerHTML="Invalid ward name"; 
              }
         else{ 
        document.getElementById('w').innerHTML="";

              }
   }
 
    j=0, i=0;
                                                                            ///DISTRICT VALIDATION



if(district==""){
e.preventDefault();
document.getElementById('ds').innerHTML="District is required!..";
 
          }
 else{

     for(i=0;i<district.length;i++)
       {
         if(!district[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
        e.preventDefault();
        document.getElementById('ds').innerHTML="Invalid district name"; 
              }
         else{ 
        document.getElementById('ds').innerHTML="";

              }
   }
 
    j=0, i=0;                     


                                                                  ///REGION VALIDATION

if(region==""){
e.preventDefault();
document.getElementById('r').innerHTML="Region is required!..";
              }
 else{
 for(i=0;i<region.length;i++)
       {
         if(!region[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
        e.preventDefault();
        document.getElementById('r').innerHTML="Invalid region  name"; 
              }
         else{ 
        document.getElementById('r').innerHTML="";

              }
   }
 
    j=0, i=0;
                                                                ///COUNTRY VALIDATION

 
if(country==""){
e.preventDefault();
document.getElementById('c').innerHTML="Country is required!..";
 

               }
 else{

    for(i=0;i<country.length;i++)
       {
         if(!country[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
        e.preventDefault();
        document.getElementById('c').innerHTML="Invalid name"; 
              }
         else{ 
        document.getElementById('c').innerHTML="";

              }
   }
 
    j=0, i=0;                                                                        




////ROOM NUMBER
var phn =/[\(0-9)]{12}/;
   
var pn =/[0-9]/i;

if(rnumber==""){
e.preventDefault();
document.getElementById('rmn').innerHTML="Number of rooms required!..";
 

              }
 else{ 
        

        ///// 
        for(i=0;i<rnumber.length;i++)
       {
         if(!rnumber[i].match(pn))
          {
             j++;

           }
        }
      
       if(j>0){
        ////
         
             
        e.preventDefault();
        document.getElementById('rmn').innerHTML="Invalid number"; 
              
          }
        
         

         else
         {

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

        }
   }
 
    j=0, i=0; 







///////HOUSE COST
if(hcost==""){
e.preventDefault();
 //document.getElementById('hc').innerHTML="House rooms required!..";
 
        document.getElementById('hc').innerHTML="";

              }
 else{ 
       
       if(currency==""){
            e.preventDefault();

                document.getElementById('cc').innerHTML="Currency is required!..";
 

             }
             else{
 
          
               document.getElementById('cc').innerHTML="";

             
              }
 
          ///// 
        for(i=0;i<hcost.length;i++)
       {
         if(!hcost[i].match(pn))
          {
             j++;

           }
        }
      
       if(j>0){
        ////
         
             
        e.preventDefault();
        document.getElementById('hc').innerHTML="Invalid cost"; 
              
          }
        
         

         else
         {

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

        }
   }
 
    j=0, i=0;

     ///PHONE NUMBER VALIDATION

 
if(phoneno==""){
e.preventDefault();
document.getElementById('p').innerHTML="Phone is required valid one!..";
 

              }
 else{ 
       
         if(!phoneno.match(phn))
          {
             
        e.preventDefault();
        document.getElementById('p').innerHTML="Invalid phone"; 
              
          }
        
         else if(phoneno.length>12)
         {
        e.preventDefault();
        document.getElementById('p').innerHTML="Valid phone number must contain 12 digits.."; 
              

         }

         else
         {

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

        }
   }
 
    j=0, i=0; 





if(popularDistination =="")
{
e.preventDefault();
document.getElementById('o').innerHTML= "Popular destination required is required!..";
 
}
 else{

     for(i=0;i<popularDistination.length;i++)
       {
         if(!popularDistination[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
        e.preventDefault();
        document.getElementById('o').innerHTML="You typed popular destination with error"; 
              }
         else{

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

              }
   }
 
    j=0, i=0;

if(hname =="")
{
e.preventDefault();
document.getElementById('hn').innerHTML= "Hotel name is required!..";
 
}
 else{

     for(i=0;i<hname.length;i++)
       {
         if(!hname[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
        e.preventDefault();
        document.getElementById('hn').innerHTML="You typed hotel name with error"; 
              }
         else{

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

              }
   }
 
    j=0, i=0; 
                                                               /// GENGER VALIDATION
 
  
}
);
}
);  
    
</script>

 