skyhigh Posted May 19, 2017 Share Posted May 19, 2017 hi guys this is my first post here and i need assistance with this, i have menu code and a sub code seperate i need to make them as 1. thats menu with a submenu, below is my code for menu $query = "SELECT a.id, a.team1, a.team2, b.auction, b.bidder, b.tagged, b.willwin, b.willlose 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); $TPL_team_list = '<select name="willwin" class="form-control">' . "\n"; while ($row = $db->fetch()) { $TPL_team_list .= "\t" . ' <option value="' . $row[''] . '" ' . $selected . '>' . $row[''] . '</option> <option class="team1" value="' . $row['team1'] . '" ' . $selected . '>' . $row['team1'] . '</option> <option class="team2" value="' . $row['team2'] . '" ' . $selected . '>' . $row['team2'] . '</option> ' . "\n"; } $TPL_team_list .= '</select>' . "\n";{$template->assign_block_vars('tag_bidder', array('TEAM' => $TPL_team_list, ));$i++;} and below is my submenu $query = "SELECT b.*, u.nick, u.rate_sum FROM " . $DBPrefix . "bids bLEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)WHERE 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); $TPL_team_list = '<select name="tagged" class="form-control">' . "\n"; while ($row = $db->fetch()) { $TPL_team_list .= "\t" . ' <option value="' . $row[''] . '" ' . $selected . '>' . $row[''] . '</option> <option value="' . $row['bidder'] . '" ' . $selected . '>' . $row['nick'] . '...' . $row['willwin'] . '</option> ' . "\n"; } $TPL_team_list .= '</select>' . "\n";{$template->assign_block_vars('tag_bidder', array('NAME' => $TPL_team_list, ));$i++;} how do i make the menu dependent. what i mean is if i select a menu that will determine what will drop down, thanks Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted May 19, 2017 Share Posted May 19, 2017 how do i make the menu dependent. what i mean is if i select a menu that will determine what will drop down, thanks Ask yourself where the main and sub menus are generated. Up in the cloud or on your server, right? Now ask yourself where you select the first menu which will determine the second menu. From the client computer you are sitting directly in front of, right? Your server only knows what it is given, and will always execute script from start to finish and then quit until another request is made from the client. The client requests the html to generate the menus, the server provides it, and the client displays it, and then the transaction id done. If the main or sub menu is changed, this entire process is repeated. You can either request all the required html each time (client sends server the currently selected main menu and the newly clicked sub menu), or do so via ajax and just request what you need. Quote Link to comment Share on other sites More sharing options...
skyhigh Posted May 19, 2017 Author Share Posted May 19, 2017 any body? Quote Link to comment Share on other sites More sharing options...
skyhigh Posted May 19, 2017 Author Share Posted May 19, 2017 no idea what u just wrote Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted May 20, 2017 Share Posted May 20, 2017 no idea what u just wrote Make sure you fully understand that the content on the client and the content on the server are totally different. If you understand this, you will understand that your server only serves content specifically based on the clients request. You can do what you are asking many ways. I assume you want to just tweak the code you posted. Both the main menu and submenu use $selected. Note that these are two totally different variables, but you didn't post all your code so no one can really tell you how they are set. Also $row[''] is definitely wrong. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.