   <?php include 'admin/includes/db_config.php'; ?>
<!--   <script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>-->
   <style>
   .search-style-one form .theme-btn{
	       padding: 5px 10px 5px 8px!important;
   }
  .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control{
	   background-color:grey;
   }
   </style>
   <script>
function getCategory(val1) { 
//	alert(2);
	if(val1==1) 
	{
		// $("#min_bedroom").disable();
		// $("#max_bedroom").disable();
		document.getElementById("min_bedroom").disabled = true;
		document.getElementById("max_bedroom").disabled = true;
	}
	else 
	{
		document.getElementById("min_bedroom").disabled = false;
		document.getElementById("max_bedroom").disabled = false;
	}
    $.ajax({
    type: "POST",
    url: "property_drop.php",
    data:'sid='+val1,
    success: function(data){
        $("#type").html(data);
    }
		
    });
}
function getPriceRange(val2) { 
//	alert(2);
	if(val2==1) 
	{
		$("#rentminpricedrop").show();
		$("#rentmaxpricedrop").show();
		$("#saleminpricedrop").hide();
		$("#salemaxpricedrop").hide();
	}
	else 
	{
		$("#rentminpricedrop").hide();
		$("#rentmaxpricedrop").hide();
		$("#saleminpricedrop").show();
		$("#salemaxpricedrop").show();
	}
    $.ajax({
    type: "POST",
    url: "property_drop.php",
    data:'sid='+val1,
    success: function(data){
        $("#type").html(data);
    }
		
    });
}
	   function getLocation(val) {
    $.ajax({
    type: "POST",
    url: "locations.php",
    data:'lid='+val,
    success: function(data){
        $("#locationlist").html(data);
    }
    });
}
</script>
  	 <?php
$category=$_REQUEST['category'];
$category1=$_REQUEST['category1'];
$type=$_REQUEST['type'];
$city=$_REQUEST['city'];
$location=$_REQUEST['location'];
$minbedroom=$_REQUEST['minbedroom'];
$maxbedroom=$_REQUEST['maxbedroom'];
$minarea=$_REQUEST['minarea'];
$maxarea=$_REQUEST['maxarea'];
if($category==1){
	$minprice=$_REQUEST['rentminprice'];
$maxprice=$_REQUEST['rentmaxprice'];
}
else if($category==2){
	$minprice=$_REQUEST['saleminprice'];
$maxprice=$_REQUEST['salemaxprice'];
}

	
		  ?>
   	<section class="property-features">
    	<div class="auto-container">
                    	<div class="content-box">
                        	<div class="bordered-layer"></div>
                        </div>
                        <!--Search Style One-->
                        <div class="search-style-one">
                        	<div class="search-outer">
                            	<div class="form-box search-form">
                                	<!--	<form action="search.php?category=<?php echo $category;?>category1=<?php echo $category1;?>&type=<?php echo $type;?>&city=<?php echo $city;?>&location=<?php echo $location;?>&bedroom=<?php echo $bedroom;?>&minarea=<?php echo $minarea;?>&maxarea=<?php echo $maxarea;?>&amount=<?php echo $minprice;?>&amount1=<?php echo $maxprice;?>" method="get"> -->
                                	<form action="search.php" method="get"> 
                                    	<div class="row clearfix">
                                        	<!--Form Group-->
                                        	<div class="form-group col-md-2 col-sm-3 col-xs-12">
                                            	<div class="field-title">Rent/Sale</div>
                                                <div class="field-inner">
                                                	<select class="form-control" id="cat1" name="category" onChange="getPriceRange(this.value);">
                                                   	<option value="" selected="selected">Select Rent/Sale</option>
                                                    <?php
				$rs1=mysqli_query($con,"select *  from tbl_category");
                while($rs=mysqli_fetch_array($rs1)) { 
        ?>
     <!--   <option value="<?php echo $rs["categoryid"]; ?>"><?php echo $rs["title"]; ?></option> -->
		 <option value="<?php echo $rs["categoryid"]; ?>" <?php if($rs["categoryid"]==$_GET['cat']) echo "selected"?>><?php echo $rs["title"]; ?></option>
        <?php
        }
        ?>
                                                    </select>
                                                </div>
                                            </div>
                                            <!--Form Group-->
                                        	<div class="form-group col-md-3 col-sm-3 col-xs-12">
                                            	<div class="field-title"> Category</div>
                                                <div class="field-inner">
                                                	<select class="form-control" id="cat2" name="category1" onChange="getCategory(this.value);">
                                                   		<option value="" selected="selected">Select Category</option>
                                                     <?php
					  $rs2=mysqli_query($con,"select *  from tbl_category1");
                while($rs3=mysqli_fetch_array($rs2)) { 
        ?>
        <!--    <option value="<?php echo $rs3["categoryid"]; ?>"><?php echo $rs3["title"]; ?></option>-->
		 <option value="<?php echo $rs3["categoryid"]; ?>" <?php if($rs3["categoryid"]==$_GET['cat1']) echo "selected"?>><?php echo $rs3["title"]; ?></option>
        <?php
        }
        ?>
                                                    </select>
                                                </div>
                                            </div>
                                            <!--Form Group-->
                                        	<div class="form-group col-md-2 col-sm-3 col-xs-12">
                                            	<div class="field-title"> Property Type</div>
                                                <div class="field-inner">
                                                	<select class="form-control" id="type" name="type">
                                                    	<option value="">Select Property Type</option>
														<?php
										$results = mysqli_query($con,"SELECT * FROM tbl_property_type WHERE category1 = ".$_GET['cat1']); ?>
										
										<?php
    while($rslocation=mysqli_fetch_array($results)) {
?>
    <option value="<?php echo $rslocation["propertytypeid"]; ?>" <?php if($rslocation["propertytypeid"]==$type) echo "selected"?>><?php echo $rslocation["title"]; ?></option>
<?php

}
?>
                                                    </select>
                                                </div>
                                            </div>
                                            <!--Form Group-->
                                            <div class="form-group col-md-2 col-sm-3 col-xs-12">
                                            	<div class="field-title"> City</div>
                                                <div class="field-inner">
                                                	<select class="form-control" id="citylist" name="city" onChange="getLocation(this.value);">
                                                      <option value="">Select City</option>
                                                       <?php
					  $rs_city=mysqli_query($con,"select *  from tbl_city");
                while($rs_city1=mysqli_fetch_array($rs_city)) { 
        ?>
        <option value="<?php echo $rs_city1["cityid"]; ?>"><?php echo $rs_city1["city"]; ?></option>
        <?php
        }
        ?>
                                                    </select>
                                                </div>
                                            </div>
											 <div class="form-group col-md-3 col-sm-3 col-xs-12">
                                            	<div class="field-title"> Location</div>
                                                <div class="field-inner">
                                                	<select class="form-control" id="locationlist" name="location">
                                                      <option value="">Select Location</option>
                                                     
                                                    </select>
                                                </div>
                                            </div>
                                           
                                         <?php if($_GET['cat1']==1){ ?>
                                     
                                         
                                         <div class="form-group col-md-1 col-sm-2 col-xs-12 minbedsearch" >
                                           	
                                            	<div class="field-title">Min. Bedrooms</div>
                                                <div class="field-inner">
                                                	<select class="form-control" name="minbedroom" id="min_bedroom" disabled >
                                                    <option value="" selected="selected">Select Min.Bedroom</option>
													<option value="0" <?php if($minbedroom=='0') echo "selected"?>>Studio</option>
													<option value="1" <?php if($minbedroom=='1') echo "selected"?>>1</option>
													<option value="2" <?php if($minbedroom=='2') echo "selected"?>>2</option>
													<option value="3" <?php if($minbedroom=='3') echo "selected"?>>3</option>
													<option value="4" <?php if($minbedroom=='4') echo "selected"?>>4</option>
													<option value="5" <?php if($minbedroom=='5') echo "selected"?>>5</option>
													<option value="6" <?php if($minbedroom=='6') echo "selected"?>>6</option>
													<option value="7" <?php if($minbedroom=='7') echo "selected"?>>7</option>
													<option value="8" <?php if($minbedroom=='8') echo "selected"?>>8</option>
													<option value="9" <?php if($minbedroom=='9') echo "selected"?>>9</option>
													<option value="10" <?php if($minbedroom=='10') echo "selected"?>>10</option>
                                                    </select>
                                                </div>
											
                                         </div>
										  <div class="form-group col-md-1 col-sm-2 col-xs-12 minbedsearch" >
                                           	<div id="bedroom">
                                            	<div class="field-title">Max. Bedrooms</div>
                                                <div class="field-inner">
                                                	<select class="form-control" name="maxbedroom" id="max_bedroom" disabled>
                                                    <option value="" selected="selected">Select Max.Bedroom</option>
													<option value="0" <?php if($maxbedroom=='0') echo "selected"?>>Studio</option>
													<option value="1" <?php if($maxbedroom=='1') echo "selected"?>>1</option>
													<option value="2" <?php if($maxbedroom=='2') echo "selected"?>>2</option>
													<option value="3" <?php if($maxbedroom=='3') echo "selected"?>>3</option>
													<option value="4" <?php if($maxbedroom=='4') echo "selected"?>>4</option>
													<option value="5" <?php if($maxbedroom=='5') echo "selected"?>>5</option>
													<option value="6" <?php if($maxbedroom=='6') echo "selected"?>>6</option>
													<option value="7" <?php if($maxbedroom=='7') echo "selected"?>>7</option>
													<option value="8" <?php if($maxbedroom=='8') echo "selected"?>>8</option>
													<option value="9" <?php if($maxbedroom=='9') echo "selected"?>>9</option>
													<option value="10" <?php if($maxbedroom=='10') echo "selected"?>>10</option>
                                                    </select>
                                                </div>
											</div>
                                         </div>
										   <?php } else {?>
										    <div class="form-group col-md-1 col-sm-2 col-xs-12 minbedsearch" >
                                           	
                                            	<div class="field-title">Min. Bedrooms</div>
                                                <div class="field-inner">
                                                	<select class="form-control" name="minbedroom" id="min_bedroom" >
                                                    <option value="" selected="selected">Select Min.Bedroom</option>
													<option value="0" <?php if($minbedroom=='0') echo "selected"?>>Studio</option>
													<option value="1" <?php if($minbedroom=='1') echo "selected"?>>1</option>
													<option value="2" <?php if($minbedroom=='2') echo "selected"?>>2</option>
													<option value="3" <?php if($minbedroom=='3') echo "selected"?>>3</option>
													<option value="4" <?php if($minbedroom=='4') echo "selected"?>>4</option>
													<option value="5" <?php if($minbedroom=='5') echo "selected"?>>5</option>
													<option value="6" <?php if($minbedroom=='6') echo "selected"?>>6</option>
													<option value="7" <?php if($minbedroom=='7') echo "selected"?>>7</option>
													<option value="8" <?php if($minbedroom=='8') echo "selected"?>>8</option>
													<option value="9" <?php if($minbedroom=='9') echo "selected"?>>9</option>
													<option value="10" <?php if($minbedroom=='10') echo "selected"?>>10</option>
                                                    </select>
                                                </div>
											
                                         </div>
										  <div class="form-group col-md-1 col-sm-2 col-xs-12 minbedsearch" >
                                           	<div id="bedroom">
                                            	<div class="field-title">Max. Bedrooms</div>
                                                <div class="field-inner">
                                                	<select class="form-control" name="maxbedroom" id="max_bedroom">
                                                    <option value="" selected="selected">Select Max.Bedroom</option>
													<option value="0" <?php if($maxbedroom=='0') echo "selected"?>>Studio</option>
													<option value="1" <?php if($maxbedroom=='1') echo "selected"?>>1</option>
													<option value="2" <?php if($maxbedroom=='2') echo "selected"?>>2</option>
													<option value="3" <?php if($maxbedroom=='3') echo "selected"?>>3</option>
													<option value="4" <?php if($maxbedroom=='4') echo "selected"?>>4</option>
													<option value="5" <?php if($maxbedroom=='5') echo "selected"?>>5</option>
													<option value="6" <?php if($maxbedroom=='6') echo "selected"?>>6</option>
													<option value="7" <?php if($maxbedroom=='7') echo "selected"?>>7</option>
													<option value="8" <?php if($maxbedroom=='8') echo "selected"?>>8</option>
													<option value="9" <?php if($maxbedroom=='9') echo "selected"?>>9</option>
													<option value="10" <?php if($maxbedroom=='10') echo "selected"?>>10</option>
                                                    </select>
                                                </div>
											</div>
                                         </div>
										   <?php } ?>
                                         
                                      <!--   <div class="form-group col-md-1 col-sm-2 col-xs-12 minbedsearch" >
                                           	
                                            	<div class="field-title">Min. Bedrooms</div>
                                                <div class="field-inner">
                                                	<select class="form-control" name="minbedroom" id="min_bedroom">
                                                    <option value="" selected="selected">Select Min.Bedroom</option>
													<option value="0">Studio</option>
													<option value="1">1</option>
													<option value="2">2</option>
													<option value="3">3</option>
													<option value="4">4</option>
													<option value="5">5</option>
													<option value="6">6</option>
													<option value="7">7</option>
													<option value="8">8</option>
													<option value="9">9</option>
													<option value="10">10</option>
                                                    </select>
                                                </div>
											
                                         </div>
										  <div class="form-group col-md-1 col-sm-2 col-xs-12 minbedsearch" >
                                           	<div id="bedroom">
                                            	<div class="field-title">Max. Bedrooms</div>
                                                <div class="field-inner">
                                                	<select class="form-control" name="maxbedroom" id="max_bedroom">
                                                    <option value="" selected="selected">Select Max.Bedroom</option>
													<option value="0">Studio</option>
													<option value="1">1</option>
													<option value="2">2</option>
													<option value="3">3</option>
													<option value="4">4</option>
													<option value="5">5</option>
													<option value="6">6</option>
													<option value="7">7</option>
													<option value="8">8</option>
													<option value="9">9</option>
													<option value="10">10</option>
                                                    </select>
                                                </div>
											</div>
                                         </div>-->
                                         <div class="form-group col-md-2 col-sm-3 col-xs-12 minareasearch">
                                            	<div class="field-title">Min. Area</div>
                                                <div class="field-inner">
                                                	<select class="form-control" name="minarea">
                                                     <option value="" selected="selected">Select Min.Area</option>
                                                     <option value="300">300 Sqft</option>
												   <option value="400">400 Sqft</option>
												   <option value="500">500 Sqft</option>
												   <option value="600">600 Sqft</option>
												   <option value="700">700 Sqft</option>
                                                    <option value="800">800 Sqft</option>
													<option value="900">900 Sqft</option>
													<option value="1000">1,000 Sqft</option>
													<option value="2000">2,000 Sqft</option>
													<option value="3000">3,000 Sqft</option>
													<option value="4000">4,000 Sqft</option>
													<option value="5000">5,000 Sqft</option>
													<option value="6000">6,000 Sqft</option>
													<option value="7000">7,000 Sqft</option>
													<option value="8000">8,000 Sqft</option>
													<option value="9000">9,000 Sqft</option>
													<option value="10000">10,000 Sqft</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-2 col-sm-3 col-xs-12 minareasearch">
                                            	<div class="field-title">Max. Area</div>
                                                <div class="field-inner">
                                                	<select class="form-control" name="maxarea">
                                                  <option value="" selected="selected">Select Max.Area</option>
                                                   <option value="400">400 Sqft</option>
												   <option value="500">500 Sqft</option>
												   <option value="600">600 Sqft</option>
												   <option value="700">700 Sqft</option>
                                                    <option value="800">800 Sqft</option>
													<option value="900">900 Sqft</option>
													<option value="1000">1,000 Sqft</option>
													<option value="2000">2,000 Sqft</option>
													<option value="3000">3,000 Sqft</option>
													<option value="4000">4,000 Sqft</option>
													<option value="5000">5,000 Sqft</option>
													<option value="6000">6,000 Sqft</option>
													<option value="7000">7,000 Sqft</option>
													<option value="8000">8,000 Sqft</option>
													<option value="9000">9,000 Sqft</option>
													<option value="10000">10,000 Sqft</option>
													<option value="11000">11,000 Sqft</option>
                                                    </select>
                                                </div>
                                            </div>
                                              <div class="form-group col-md-2 col-sm-3 col-xs-12 minareasearch">
                                            	<div class="field-title">Min. Price</div>
                                                <div class="field-inner">
                                                	<!--<input type="text" class="form-control" name="amount">-->
													<select class="form-control" name="rentminprice" id="rentminpricedrop">
                                                  <option value="" selected="selected">Select Min.Price</option>
                                                   <option value="10000">10,000 AED</option>
												   <option value="20000">20,000 AED</option>
												   <option value="30000">30,000 AED</option>
												   <option value="40000">40,000 AED</option>
                                                    <option value="50000">50,000 AED</option>
													<option value="60000">60,000 AED</option>
													<option value="70000">70,000 AED</option>
													<option value="80000">80,000 AED</option>
													<option value="90000">90,000 AED</option>
													<option value="100000">100,000 AED</option>
													<option value="200000">200,000 AED</option>
													<option value="300000">300,000 AED</option>
													<option value="400000">400,000 AED</option>
													<option value="500000">500,000 AED</option>
                                                    </select>
													<select class="form-control" name="saleminprice" id="saleminpricedrop" style="display:none;">
                                                  <option value="" selected="selected">Select Min.Price</option>
                                                    <option value="100000">100,000 AED</option>
												   <option value="200000">200,000 AED</option>
												   <option value="300000">300,000 AED</option>
												   <option value="400000">400,000 AED</option>
                                                    <option value="500000">500,000 AED</option>
													<option value="600000">600,000 AED</option>
													<option value="700000">700,000 AED</option>
													<option value="800000">800,000 AED</option>
													<option value="900000">900,000 AED</option>
													<option value="1000000">1,000,000 AED</option>
													<option value="2000000">2,000,000 AED</option>
													<option value="3000000">3,000,000 AED</option>
													<option value="4000000">4,000,000 AED</option>
													<option value="5000000">5,000,000 AED</option>
													<option value="6000000">6,000,000 AED</option>
													<option value="7000000">7,000,000 AED</option>
													<option value="8000000">8,000,000 AED</option>
													<option value="9000000">9,000,000 AED</option>
													<option value="10000000">10,000,000 AED</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-2 col-sm-3 col-xs-12 minareasearch">
                                            	<div class="field-title">Max. Price</div>
                                                <div class="field-inner">
                                                	<!--<input type="text" class="form-control" name="amount1">-->
													<select class="form-control" name="rentmaxprice" id="rentmaxpricedrop">
                                                  <option value="" selected="selected">Select Max.Price</option>
												   <option value="20000">20,000 AED</option>
												   <option value="30000">30,000 AED</option>
												   <option value="40000">40,000 AED</option>
                                                    <option value="50000">50,000 AED</option>
													<option value="60000">60,000 AED</option>
													<option value="70000">70,000 AED</option>
													<option value="80000">80,000 AED</option>
													<option value="90000">90,000 AED</option>
													<option value="100000">100,000 AED</option>
													<option value="200000">200,000 AED</option>
													<option value="300000">300,000 AED</option>
													<option value="400000">400,000 AED</option>
													<option value="500000">500,000 AED</option>
                                                    </select>
													<select class="form-control" name="salemaxprice" id="salemaxpricedrop" style="display:none;">
                                                  <option value="" selected="selected">Select Max.Price</option>
												   <option value="200000">200,000 AED</option>
												   <option value="300000">300,000 AED</option>
												   <option value="400000">400,000 AED</option>
                                                    <option value="500000">500,000 AED</option>
													<option value="600000">600,000 AED</option>
													<option value="700000">700,000 AED</option>
													<option value="800000">800,000 AED</option>
													<option value="900000">900,000 AED</option>
													<option value="1000000">1,000,000 AED</option>
													<option value="2000000">2,000,000 AED</option>
													<option value="3000000">3,000,000 AED</option>
													<option value="4000000">4,000,000 AED</option>
													<option value="5000000">5,000,000 AED</option>
													<option value="6000000">6,000,000 AED</option>
													<option value="7000000">7,000,000 AED</option>
													<option value="8000000">8,000,000 AED</option>
													<option value="9000000">9,000,000 AED</option>
													<option value="10000000">10,000,000 AED</option>
                                                    </select>
                                                </div>
                                            </div>
                                        <!--	<div class="form-group col-md-1 col-sm-1 col-xs-12">
                                            	<div class="field-title">&nbsp;</div>
                                            	<div class="field-inner text-right"><button type="submit" name="search" class="theme-btn btn-style-one"><span class="icon fa fa-search"></span>Search</button></div>
                                            </div>-->
											<div class="form-group col-md-2 col-sm-2 col-xs-12 searchbutton">
                                            	<div class="field-title">&nbsp;</div>
                                            	<div class="field-inner text-right"><button type="submit" name="search" class="theme-btn btn-style-one">Search</button></div>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div><!--Search Style One-->
                        
                    </div>
    </section>