0
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
#prodbrand,#prodname,#prodsize,#prodcolor,#prodtype,#prodminprise,#prodmaxprise
    {
    border: 1px solid #d1caca;
    font-size: 14px;
    background: #f8f4f4;
    margin-top: 3px;
    color: #205a60;
}

#prodnamelist,#prodbrandlist,#prodsizelist {
    font-size: 12px;
}

[type=checkbox]:after {
    content: attr(value);
    margin: -3px 15px;
    vertical-align: top;
    white-space: nowrap;
    display: inline-block;
}
</style>
</head>
<script src="jquery.js"></script>
<script language="javascript">   $("#prodminprise").click(function(){ 
        $("#prodminpriselist").slideToggle();  });

    $("#prodbrand").click(function(){ 
        $("#prodbrandlist").slideToggle();  });



    $("#prodname").click(function(){
        $("#prodnamelist").slideToggle();
    });

    $("#prodsize").click(function(){
        $("#prodsizelist").slideToggle();
    });

    $("#prodcolor").click(function(){
        $("#prodcolorlist").slideToggle('400');
    });

    $("#prodtype").click(function(){
        $("#prodtypelist").slideToggle('400');
    });
    </script>
<script language="javascript"
    src="https://code.jquery.com/jquery-1.11.1.min.js"
    type="text/javascript"></script>

<script language="javascript" type="text/javascript">


    $('#.manufactureBy').click(function(){
                var value= $(this).val();
                $.ajax({
                    url: 'deleteProduct.php',
                    type: 'POST',
                    data: {check:value},

                    success: function(data){
                        alert(data);
                    }
                });


            });



            </script>
<body width="200">



    <?php
    if(isset($_POST['key'] )){

        if($_POST['key']=="all"){
            $_POST['key']=null;
        }
        $key1 = trim($_POST['key']); //        if($key1.length> 1){
        $con = mysql_connect("localhost","root","1234");
        if (!$con) {
            die('Could not connect: ' . mysql_error());
        }
        mysql_select_db("productdetails", $con);

        $sql= ("SELECT   upper(pname), upper(manufacturBy), upper(psize),upper(pcolor),upper(pType)  FROM proddetail where shortSearch like '%".$key1."%' or pcolor like '".$key1."%' or pType like '".$key1."%' or psize like '".$key1."%'");
        $query = mysql_query($sql);
        $sqlp=("select min(saleprize),max(saleprize) from proddetail where shortSearch like '%".$key1."%' or pcolor like '".$key1."%' or pType like '".$key1."%'");
        $queryp = mysql_query($sqlp);
        while($rowp = mysql_fetch_array($queryp)){

            $MinPraise= $rowp['min(saleprize)'];
            $MaxPraise =$rowp['max(saleprize)'];

        }    while($row = mysql_fetch_array($query)){

            $manufactur[] = $row['upper(manufacturBy)'];
            $productnam[] = $row['upper(pname)'];
            $productsiz[] = $row['upper(psize)'];
            $productcolor[] = $row['upper(pcolor)'];
            $productmaxpris[] = $row['max(saleprize)'];
            $producttyp[] = $row['upper(pType)'];
        }

        $manufacture = array_unique($manufactur);
        $productname = array_unique($productnam);
        $productsize = array_unique($productsiz);
        $productcolors = array_unique($productcolor);
        $producttype = array_unique($producttyp);

        ?>
    <div id="prodminprise">
        <span>prise</span>
    </div>
    <div id="prodminpriselist">
        <?php
        echo 'Min : '. $MinPraise;
        echo '<br>Max : '. $MaxPraise;  ?>
    </div>

    <!--</div>-->
    <div id="leftFilters">
        <div id="prodbrand">
            <span id="plus"></span><span>Brand</span>
        </div>
        <div id="prodbrandlist">
            <?php            
            foreach ($manufacture as $brand) {
                ?>
            <input name="select[<?php echo $brand; ?>]" type="checkbox"
                class="manufactureBy" id="click_checkbox"
                value="<?php echo $brand; ?>">
            <?php // echo $brand; ?>
            </label> <br>
            <?php } ?>
        </div>
        <div id="prodname">
            <span>Prod. Name</span>
        </div>
        <div id='prodnamelist'>
            <?php  foreach ($productname as $proname) {     
                ?>
            <input type="checkbox" class="productname"
                value="<?php echo $proname; ?>">
            <?php // echo $proname; ?>
            <br>
            <?php  } ?>
        </div>
        <div id="prodsize">
            <span>Size</span>
        </div>
        <div id="prodsizelist">
            <?php   foreach ($productsize as $prosize) {      
                ?>
            <input type="checkbox" class="productsize"
                value="<?php echo $prosize; ?>" onclick="doit()">
            <?php // echo $prosize; ?>
            <br>
            <?php }  ?>
        </div>
        <div id="prodcolor">
            <span>Color</span>
        </div>
        <div id="prodcolorlist">
            <?php   foreach ($productcolors as $procolor) {      
                ?>
            <input type="checkbox" class="productcolor"
                value="<?php echo $procolor; ?>" onclick="doit()">
            <?php // echo $procolor; ?>
            <br>
            <?php }  ?>
        </div>
        <div id="prodtype">
            <span>Products/Type</span>
        </div>
        <div id="prodtypelist">
            <?php   foreach ($producttype as $protype) {      
                ?>
            <input type="checkbox" class="producttype"
                value="<?php echo $protype; ?>" onclick="doit()">
            <?php // echo $protype; ?>
            <br>
            <?php }  ?>
        </div>
    </div>
    <?php } ?>

</body>
</html>
1
  • 1
    $('#.manufactureBy').click(function(){ change this to $('.manufactureBy').click(function(){ it is class so that put ., not both. and put script at the last of page to laod it fast. Commented Jan 25, 2016 at 6:35

1 Answer 1

1

You can just change the selection in jQuery as:

$('.manufactureBy').click(function(){
   var value= $(this).val();
console.log(value); // checkbocx value
..........
});

You can not use like that:

$('#.manufactureBy')

because you are using manufactureBy as a class name of checkboc input field. for getting input value by using class name just use $('.yourClassName').

When you want to get input values by using ID attribute than you can just change it as: $('#yourIDName').

Sign up to request clarification or add additional context in comments.

5 Comments

Yeah sir I got thank you, but i can't print it in php server file
@RajuAV: in php, you can get as $_POST['check']
Yeah sir i have done like the bellow code but not getting if($_POST['check']){ $leftBrand=$_POST['check']; // print_r($leftBrand); echo $leftBrand; }
check if(isset($_POST['check'])){ var_dump($_POST['check']); } @RajuAV
Sir.. I'm going to tell you clearly.. This is shoping site I want to display when i click an object it should go to server to find the product. but before this i have sent a value through the search box. For filter the product if user click on left side it should open the related product in the right side display div.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.