Click here to Skip to main content
14,832,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
  <script>
  $(document).ready(function () {
  var $article = null;
  var $business = null;

  $('#category').change(function () {
   var categoryName = $('#category').val();

   if ($article == null) {
    $article = $('<h4>Select a business you wish to view.</h4><select id="article" name="article">
    <option value="0">Select A Business To View Listing</option>
    </select>').appendTo('.query');
   }
   });
  });
</script>


Using this JQuery script can you adjust it to run this query upon selecting an object from the first select box & change the query to include the selection Where Category = "$('#category').val();"

<?php
        $con = mysqli_connect(,,,,);
        // Check connection
        if (mysqli_connect_errno())
           {
           echo "<option>Failed to connect to MySQLi</option>" ;
           }
        $result = mysqli_query($con,"SELECT Bname FROM Business WHERE Category='$('#category').val();
' ");
         while($row = mysqli_fetch_array($result)) {
          echo "<option value='".$row['Bname']."'>".$row['Bname']."</option>";
          }
          // Free result set
         mysqli_free_result($result);
         mysqli_close($con);
?>
Posted

1 solution

   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900