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=""></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>

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();"

        $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

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