<?php
include 'database.php';
//include 'init.php';
$brand=$_GET['brand'];
//$sql1="SELECT * FROM product WHERE brand IN ($brand)";
$sql=mysql_query("SELECT * FROM product WHERE brand IN ($brand)");
//print_r($res);
//$br=str_replace(',' ,' or brand =',$brand);
//$string = "'" . implode("','", $array) . "'";
//echo $br;
//$sql='select * from product where brand = '.$br.'';
//$res=mysql_query($sql);
//$pro=mysql_fetch_array($res);
// $pro=$product->searchproducts($br);
//$pro=$product->getallproducts();
//$string = "'" . implode("','", $array) . "'";
//print_r($pro);
?>
<script type="text/javascript" src="js/jquery.js"></script>
<!--<script type="text/javascript">
function searchData(str)
{
//alert(str);
//return;
var brand = new Array();
var a = '';
var boxes = document.getElementsByClassName("brand");
for (var i=0;i<boxes.length;i++) {
var box = boxes[i];
if (box.type == "checkbox" && box.checked) {
brand[brand.length] = box.value;
}
}
var energy = brand.join();
/*var brand = new Array();
var brand[] = document.getElementById('brand').value;*/
window.location="http://localhost/category/showproduct.php?brand="+energy;
}
</script>-->
<script type="text/javascript">
function searchData(str)
{
//alert(str);
//return;
var brand = new Array();
var price = new Array();
var a = '';
var boxes = document.getElementsByClassName("brand");
var boxes1 = document.getElementsByClassName("price");
for (var i=0;i<boxes.length;i++) {
var box = boxes[i];
if (box.type == "checkbox" && box.checked) {
brand[brand.length] = box.value;
}
}
for (var i=0;i<boxes1.length;i++) {
var box1 = boxes1[i];
if (box1.type == "checkbox" && box1.checked) {
price[price.length] = box1.value;
}
}
var brands = brand.join();
var prices = price.join();
/*var brand = new Array();
var brand[] = document.getElementById('brand').value;*/
window.location="http://localhost/category/showproduct.php?brand="+brands;
}
</script>
<div id="demo"></div>
<?php
if(isset($_POST['search']))
{
$brand=$_POST['brand'];
print_r($brand);
$br=implode('or brand =',$brand);
echo $br;
foreach($brand as $br)
{
$pro=$product->searchproducts($br);
}
//print_r($pro);
}
$levis=$puma=$komal=$ketan = '';
if(isset($_GET['brand'])){
$aa = explode(",",$_GET['brand']);
if (in_array("'levis'", $aa)) $levis = 'checked="checked"';
if (in_array("'puma'", $aa)) $puma = 'checked="checked"';
if (in_array("'komal'", $aa)) $komal = 'checked="checked"';
if (in_array("'ketan'", $aa)) $ketan = 'checked="checked"';
}
?>
<div style="width:100%;margin:0 auto;">
<div style="width:20%;float:left;">
<form action="" method="post">
<h3>BRAND</h3>
<input class="brand" <?php echo $levis;?> type="checkbox" name="brand[]" value="'levis'" id="brand" onclick="searchData(this.value)">Levis<br/>
<input class="brand" <?php echo $puma;?> type="checkbox" name="brand[]" value="'puma'" id="brand" onclick="searchData(this.value)" >Puma<br/>
<input class="brand" <?php echo $komal;?> type="checkbox" name="brand[]" value="'komal'" id="brand2" onclick="javascript:return searchData(this.value);">Komal<br/>
<input class="brand" <?php echo $ketan;?> type="checkbox" name="brand[]" value="'ketan'" id="brand3" onclick="javascript:return searchData(this.value);">Ketan<br/>
<h3>PRICE</h3>
<input class="price" type="checkbox" name="price[]" value="Below 300" onclick="searchData(this.value)">Below 300<br/>
<input class="price" type="checkbox" name="price[]" value="300-500" onclick="searchData(this.value)">300-500<br/>
<input class="price" type="checkbox" name="price[]" value="500-1200" onclick="searchData(this.value)">500-1200<br/>
<input class="price" type="checkbox" name="price[]" value="Above 1200" onclick="searchData(this.value)">Above 1200<br/>
<h3>CATEGORY</h3>
<input type="checkbox" name="category" value="Jeans">Jeans<br/>
<input type="checkbox" name="category" value="Tshirt">Tshirt<br/>
<input type="checkbox" name="category" value="Suits">Suits<br/>
<input type="checkbox" name="category" value="Sarees">Sarees<br/>
</form>
</div>
<div id="productlist" style="width:80%;float:left;">
<?php
while($product=mysql_fetch_array($sql))
{?>
<div style="width:20%;margin-top:10px;float:left;margin-left:10px;border:1px solid;">
<div style="text-align:center;">
<img src="upload/<?php echo $product['img'];?>" style="width:200px;height:150px;">
</div>
<span style="color:red;">Category:</span><span><?php echo $product['category'];?></span><br/>
<span style="color:red;">Product:</span><span><?php echo $product['pro_name'];?></span><br/>
<span style="color:red;">Brand:</span><span><?php echo $product['brand'];?></span><br/>
<span style="color:red;">Price:</span><span><?php echo $product['price'];?></span><br/>
</div>
<?php
}
?>
</div>
</div>
include 'database.php';
//include 'init.php';
$brand=$_GET['brand'];
//$sql1="SELECT * FROM product WHERE brand IN ($brand)";
$sql=mysql_query("SELECT * FROM product WHERE brand IN ($brand)");
//print_r($res);
//$br=str_replace(',' ,' or brand =',$brand);
//$string = "'" . implode("','", $array) . "'";
//echo $br;
//$sql='select * from product where brand = '.$br.'';
//$res=mysql_query($sql);
//$pro=mysql_fetch_array($res);
// $pro=$product->searchproducts($br);
//$pro=$product->getallproducts();
//$string = "'" . implode("','", $array) . "'";
//print_r($pro);
?>
<script type="text/javascript" src="js/jquery.js"></script>
<!--<script type="text/javascript">
function searchData(str)
{
//alert(str);
//return;
var brand = new Array();
var a = '';
var boxes = document.getElementsByClassName("brand");
for (var i=0;i<boxes.length;i++) {
var box = boxes[i];
if (box.type == "checkbox" && box.checked) {
brand[brand.length] = box.value;
}
}
var energy = brand.join();
/*var brand = new Array();
var brand[] = document.getElementById('brand').value;*/
window.location="http://localhost/category/showproduct.php?brand="+energy;
}
</script>-->
<script type="text/javascript">
function searchData(str)
{
//alert(str);
//return;
var brand = new Array();
var price = new Array();
var a = '';
var boxes = document.getElementsByClassName("brand");
var boxes1 = document.getElementsByClassName("price");
for (var i=0;i<boxes.length;i++) {
var box = boxes[i];
if (box.type == "checkbox" && box.checked) {
brand[brand.length] = box.value;
}
}
for (var i=0;i<boxes1.length;i++) {
var box1 = boxes1[i];
if (box1.type == "checkbox" && box1.checked) {
price[price.length] = box1.value;
}
}
var brands = brand.join();
var prices = price.join();
/*var brand = new Array();
var brand[] = document.getElementById('brand').value;*/
window.location="http://localhost/category/showproduct.php?brand="+brands;
}
</script>
<div id="demo"></div>
<?php
if(isset($_POST['search']))
{
$brand=$_POST['brand'];
print_r($brand);
$br=implode('or brand =',$brand);
echo $br;
foreach($brand as $br)
{
$pro=$product->searchproducts($br);
}
//print_r($pro);
}
$levis=$puma=$komal=$ketan = '';
if(isset($_GET['brand'])){
$aa = explode(",",$_GET['brand']);
if (in_array("'levis'", $aa)) $levis = 'checked="checked"';
if (in_array("'puma'", $aa)) $puma = 'checked="checked"';
if (in_array("'komal'", $aa)) $komal = 'checked="checked"';
if (in_array("'ketan'", $aa)) $ketan = 'checked="checked"';
}
?>
<div style="width:100%;margin:0 auto;">
<div style="width:20%;float:left;">
<form action="" method="post">
<h3>BRAND</h3>
<input class="brand" <?php echo $levis;?> type="checkbox" name="brand[]" value="'levis'" id="brand" onclick="searchData(this.value)">Levis<br/>
<input class="brand" <?php echo $puma;?> type="checkbox" name="brand[]" value="'puma'" id="brand" onclick="searchData(this.value)" >Puma<br/>
<input class="brand" <?php echo $komal;?> type="checkbox" name="brand[]" value="'komal'" id="brand2" onclick="javascript:return searchData(this.value);">Komal<br/>
<input class="brand" <?php echo $ketan;?> type="checkbox" name="brand[]" value="'ketan'" id="brand3" onclick="javascript:return searchData(this.value);">Ketan<br/>
<h3>PRICE</h3>
<input class="price" type="checkbox" name="price[]" value="Below 300" onclick="searchData(this.value)">Below 300<br/>
<input class="price" type="checkbox" name="price[]" value="300-500" onclick="searchData(this.value)">300-500<br/>
<input class="price" type="checkbox" name="price[]" value="500-1200" onclick="searchData(this.value)">500-1200<br/>
<input class="price" type="checkbox" name="price[]" value="Above 1200" onclick="searchData(this.value)">Above 1200<br/>
<h3>CATEGORY</h3>
<input type="checkbox" name="category" value="Jeans">Jeans<br/>
<input type="checkbox" name="category" value="Tshirt">Tshirt<br/>
<input type="checkbox" name="category" value="Suits">Suits<br/>
<input type="checkbox" name="category" value="Sarees">Sarees<br/>
</form>
</div>
<div id="productlist" style="width:80%;float:left;">
<?php
while($product=mysql_fetch_array($sql))
{?>
<div style="width:20%;margin-top:10px;float:left;margin-left:10px;border:1px solid;">
<div style="text-align:center;">
<img src="upload/<?php echo $product['img'];?>" style="width:200px;height:150px;">
</div>
<span style="color:red;">Category:</span><span><?php echo $product['category'];?></span><br/>
<span style="color:red;">Product:</span><span><?php echo $product['pro_name'];?></span><br/>
<span style="color:red;">Brand:</span><span><?php echo $product['brand'];?></span><br/>
<span style="color:red;">Price:</span><span><?php echo $product['price'];?></span><br/>
</div>
<?php
}
?>
</div>
</div>
EmoticonEmoticon