the menu works fine but the sub menu disappears when i select a menu, what am doing wrong thanks

    $query = "SELECT a.id, a.team1, a.team2, b.auction, b.bidder, b.tagged, b.willwin FROM " . $DBPrefix . "auctions a
        LEFT JOIN " . $DBPrefix . "bids b ON (b.auction = a.id)
        WHERE a.id = :auc_id and a.id = a.id group by a.id";
        $params = array();
        $params[] = array(':auc_id', $id, 'int');
        $db->query($query, $params);

    ?> <select name="country" id="sports-list" onchange="changeSelect( this.value )"> <option value="1">Select Team</option> <?php
    if ($db->numrows() > 0) {
    // output data of each row
    while ($row = $db->fetch()) {
    ?> <option value="<?php echo $row["willwin"]; ?>"><?php echo $row["team1"]; ?></option> <option value="<?php echo $row["willlose"]; ?>"><?php echo $row["team2"]; ?></option> <?php
    }
}
?> </select> </br></br></br><div id="subcats"> <select name="bidder" id="bids-list"> <option value='1'>Select Number</option> </select></div> <?php
    $willlose = mysqli_real_escape_string($_POST['willlose']);
    if($willlose!='')
    {

    $query = "SELECT b.*, u.nick, u.rate_sum FROM " . $DBPrefix . "bids b 
    LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)
    WHERE b.willlose=".$willlose." and b.bidder NOT IN ('b.tagged') and b.tagged IN ('b.bidder') and b.auction = :auc_id order by b.willwin";
    $params = array();
    $params[] = array(':auc_id', $id, 'int');
    $db->query($query, $params);

    $options = "<option value=''>Select Name</option>";
    while ($row = $db->fetch()) {
    $options .= "<option value='".$row['auction']."'>".$row['nick']."</option>";
    }
    echo $options;
    }

    ?> <script src="js/dropdown/jquery-1.3.0.min.js"></script> <script>
    $('#sports-list').on('change', function(){
    var willlose = this.value;
    $.ajax({
    type: "POST",
    data:'willlose='+willlose,
    success: function(result){
    $("#bids-list").html(result);
    }
    });
    });

    </script> 
Member Avatar
diafol

This code is a mish-mash of html and php - it is almost impossible to read. Try to separate your markup and code as much as possible - or face a maintenance nightmare.

Is dbprefix set properly (with a period?)

Member Avatar
diafol

Why the link? Please explain. You post an update a month later giving us no idea of what's going on.