<? include("header.php");

//session_start();
//error_reporting(0);

$id=$_REQUEST['id'];

include ("include/db-connect.php");

if(isset($_REQUEST['submit']))
 {
	   $cat=$_REQUEST['cat'];
	   $sub=$_REQUEST['sub_cat'];
	   
	   
	   ?>
    <script>
	window.location='view_search2.php?cat=<?php echo base64_encode($cat);?>&sub=<?php echo base64_encode($sub);?>';
	</script>
 <? 

     //header("location:viewproductsearch.php?cat=$cat&&sub=$sub"); 
}
 

?>
<?php	
$sqlCountry="select id,category_name from ".$CAT." where code='1'  order by category_name asc ";
$resCountry=mysql_query($sqlCountry);
$checkCountry=mysql_num_rows($resCountry); 
?>  
  
  <script type="text/javascript">




function showstate(str)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHintstate").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","loadData.php?q="+str,true);
xmlhttp.send();
}
function showcity(str)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHintcity").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","city_ajax.php?q="+str,true);
xmlhttp.send();
}
</script>

<div id="content" >
  <div class="breadcrumb" >
       <!-- <a href="http://amarasudhan.com/admin/index.php?route=common/home&amp;token=b735cc089ec2d51abb9a8e1901f501fb">Home</a>-->
      </div>
              <div class="box" >
    <div class="heading" >
      <h1><img src="view/image/home.png" alt="" />Search Products</h1>
    </div>
    <div class="content">
      <div class="overview" style="width:50%;  margin-left:300px;">
        <div class="dashboard-heading"> Products</div>
        <div class="dashboard-content">
        
 
 <?php if($_REQUEST['ed']=='su'){ echo "<div class='alert_succes'>Contact Edited Successfully</div>"; } else { echo "";}?>

 <form action="" method="post" enctype="multipart/form-data" id="question" >
<!--  <script type="text/javascript" src="../prototype.js"></script>
  <script type="text/javascript" src="../validation.js"></script>   
  <script src="../ckeditor.js"></script>
  -->      
		<div class="add_row" style="margin-top:20px"><div id="wrapper">
		<div class="wrap_box">
        
                <div style="float:left; width:200px;">Category Name&nbsp;<font color="#FF0000">*</font>	</div> 
    			<?php
			    if($checkCountry > 0){
				?>
                       <div class="wrap_box" style="margin-left:200px;">
              			<select name="cat" onChange="showstate(this.value)" class="required">
						<option value="">Select Category</option>
						<?php
						while($rowCountry=mysql_fetch_array($resCountry))
						{
						?>
						<option value="<?php echo $rowCountry['category_name']?>"><?php echo $rowCountry['category_name']?></option>
						<?php
							}
						?>
						</select>
						</div>
                        <div class="spacer"></div>
     
                    <br />
                    
                    
					
                                        
                            <div style="float:left;width:200px;">Sub Category Name</div> 
							<div id="txtHintstate" style="margin-left:200px;">
                            <select  name="sub_cat"  onChange="showcity(this.value)" class="required">
                            <option value="">Select Sub Category</option>
                            </select>
                            </div>
                            <div class="spacer"></div>  <br />
                            
				        <?php
			            }else{
				        echo 'No Country Name Found';
			            }
			             ?>
                            <div class="spacer"></div>
                            
	
                      
                         <div style="margin-left:200px;"><input type="submit" name="submit" id="butt
                         
                         on" value="Submit" ><br><br>
                         <a href="javascript: history.go(-1)"><img src="images/bac.jpg"></a></div>
                      
                    
 
   </form>
        </div>
      </div>
      </div></div>
      
    </div>
  </div>
</div>
<!--[if IE]>
<script type="text/javascript" src="view/javascript/jquery/flot/excanvas.js"></script>
<![endif]--> 
<script type="text/javascript" src="view/javascript/jquery/flot/jquery.flot.js"></script> 
<script type="text/javascript"><!--
function getSalesChart(range) {
	$.ajax({
		type: 'get',
		url: 'index.php?route=common/home/chart&token=b735cc089ec2d51abb9a8e1901f501fb&range=' + range,
		dataType: 'json',
		async: false,
		success: function(json) {
			var option = {	
				shadowSize: 0,
				lines: { 
					show: true,
					fill: true,
					lineWidth: 1
				},
				grid: {
					backgroundColor: '#FFFFFF'
				},	
				xaxis: {
            		ticks: json.xaxis
				}
			}

			$.plot($('#report'), [json.order, json.customer], option);
		}
	});
}

getSalesChart($('#range').val());
//--></script> 
</div>
<?  include("footer.php"); ?>