Jump to content

selvam1985

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by selvam1985

  1. 30 minutes ago, selvam1985 said:

    MAIN.PHP

    <html>
    <form name="input">
        <input type="date" id="userdate">
        <input type="text" size="50" id="searchterm">
    </form>
    <div id="content"></div>


    </html><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css" />
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js">
    </script> 


    <script>
    $(document).ready(function () {
                 $('#searchterm').change(function() {
                userdate = $("#userdate").val();
                searchterm = $("#searchterm").val();
                $.ajax({
                    type:'GET',
                    url: 'test2.php',
                    data: {userdate:userdate,searchterm    :searchterm},
                     dataType: "json",
                    async: false,
                    success: function(data)
                    {
                        alert(data);
                         document.getElementById('#content').innerHTML += value;
                        $("#content").html(data);
                         
                        //console.log(data);
                    }
                });
            });
        });
    </script>

     

     

    TEST2.PHP

    <?php 

    include('/include/config1.php');

    $kdt = $_GET['userdate']; 
    $searchTerm = $_GET['searchterm']; 

    $select =mysql_query("SELECT man_id,man_name,join_date FROM manmaster where (man_id LIKE '%".$searchTerm."%' or man_name LIKE '%".$searchTerm."%')
     and join_date<='$kdt' ") or die('Query not Executed..!..' .mysql_error());
     while ($row=mysql_fetch_array($select))
    {
        $data[] = $row['join_date']."-".$row['man_id']."-".trim($row['man_name']);
        //$data[] = $row['eff_date']."-".$row['token_id']."-".$row['man_id']."-".trim($row['man_name']);
        //$data[] = $row['token_id']."-".$row['man_id']."-".trim($row['man_name'])."-(".$row['eff_date'].")";
        
    }    

    echo json_encode($data);

    ?>

     

    THE FOLLOWING AUTOSEARCH CODE WORKING FINE...but here i didnot know how to  pass the date value  then the employee id or Employee name value

    <script> 
    //type="text/javascript">
    $(function() 
    {
     $( "#searchterm" ).autocomplete({
        //source:"autosearchwithdate.php?effdate="+$('#effdate').val()+"&"+"empsearch="+$('#empsearch').val(),
      source: 'autocomplete_salary.php'
      //source: 'autosearchwithdate.php'
     });
    });

    </script>

     

     

     

    The above coding when i enter the Date column then the next column displays the autoserched value..

    That is i need the employee id and names in the autosearch option before the entered date...

    I have attached the Screenshots

    1044470628_autosearchscreen.thumb.jpg.dad05f7ab79009a818ee2dfca325d4ca.jpg

  2. MAIN.PHP

    <html>
    <form name="input">
        <input type="date" id="userdate">
        <input type="text" size="50" id="searchterm">
    </form>
    <div id="content"></div>
    
    
    </html><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css" />
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js">
    </script> 
    
    
    <script>
    $(document).ready(function () {
                 $('#searchterm').change(function() {
                userdate = $("#userdate").val();
                searchterm = $("#searchterm").val();
                $.ajax({
                    type:'GET',
                    url: 'test2.php',
                    data: {userdate:userdate,searchterm    :searchterm},
                     dataType: "json",
                    async: false,
                    success: function(data)
                    {
                        alert(data);
                         document.getElementById('#content').innerHTML += value;
                        $("#content").html(data);
                         
                        //console.log(data);
                    }
                });
            });
        });
    </script>

     

     

    TEST2.PHP

    <?php 
    
    include('/include/config1.php');
    
    $kdt = $_GET['userdate']; 
    $searchTerm = $_GET['searchterm']; 
    
    $select =mysql_query("SELECT man_id,man_name,join_date FROM manmaster where (man_id LIKE '%".$searchTerm."%' or man_name LIKE '%".$searchTerm."%')
     and join_date<='$kdt' ") or die('Query not Executed..!..' .mysql_error());
     while ($row=mysql_fetch_array($select))
    {
        $data[] = $row['join_date']."-".$row['man_id']."-".trim($row['man_name']);
        //$data[] = $row['eff_date']."-".$row['token_id']."-".$row['man_id']."-".trim($row['man_name']);
        //$data[] = $row['token_id']."-".$row['man_id']."-".trim($row['man_name'])."-(".$row['eff_date'].")";
        
    }    
    
    echo json_encode($data);
    
    ?>

     

    THE FOLLOWING AUTOSEARCH CODE WORKING FINE...but here i didnot know how to  pass the date value  then the employee id or Employee name value

    <script> 
    //type="text/javascript">
    $(function() 
    {
     $( "#searchterm" ).autocomplete({
        //source:"autosearchwithdate.php?effdate="+$('#effdate').val()+"&"+"empsearch="+$('#empsearch').val(),
      source: 'autocomplete_salary.php'
      //source: 'autosearchwithdate.php'
     });
    });
    
    </script>

     

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.