houdini_tx Posted October 20, 2009 Share Posted October 20, 2009 I have been looking at this for days now. I have a drop down menu that get it's values from an sql database That works but now I want to get the item and pass it to another query that's where I get lost or I may have been lost from the start and got lucky. Here is the code I have <form action="" method="post" name="test"></form> <select name="flt_game" id="flt_game" onChange="document.test.submit();"> <?php $sql2 = "SELECT Pilot_Number, Pilot_Name FROM Logger_pilots ORDER BY Pilot_Number"; $result2 = $db-> sql_query($sql2); while ($row = $db->sql_fetchrow($result2)) { $pilotid = $row[Pilot_Number]; $pilot1 = $row[Pilot_Name]; if ($pilotid == $pilot1) { $sel = "selected "; } echo "<option $sel value=\"$pilot1\">$pilot1</option> \n"; $sel = ""; } ?> </select> </form> <?php echo "You selected $sel "; echo "<br><br>"; echo "<b>A/A Kill Average By Aircraft `flt_game`</b><br><br></center>"; $a = 1; $sql5 = "SELECT Pilot_Name AS pilot , Aircraft AS aircraft1 , round((SUM(Kills) / SUM(Killed))*1,2) AS hrs FROM logger_stats WHERE Pilot_Name = '$pilot1' GROUP BY Pilot_Name, Aircraft ORDER BY hrs DESC LIMIT 0,100"; $result5=sql_query($sql5, $db); while(list($pilot, $aircraft1, $hrs) = sql_fetch_row($result5, $db)) { echo "<font color=\"#CC9900\" >$a: $aircraft1 </font><em>($hrs Kills)</em><br>"; $a++; } Thanks For the Help Mike Link to comment https://forums.phpfreaks.com/topic/178296-having-a-problem-get-the-selected-item-from-a-drop-down-menu/ Share on other sites More sharing options...
radox Posted October 20, 2009 Share Posted October 20, 2009 change: echo "You selected $sel "; to: echo "You selected $pilot1"; Link to comment https://forums.phpfreaks.com/topic/178296-having-a-problem-get-the-selected-item-from-a-drop-down-menu/#findComment-940682 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.