Having a problem get the selected item from a drop down menu
Posted on
16th Feb 2014 07:03 pm by
admin
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
Code: [Select] <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 "
";
echo "<b>A/A Kill Average By Aircraft `flt_game`</b>
</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>
";
$a++;
}
Thanks For the Help
No comments posted yet
Your Answer:
Login to answer
186
30
Other forums
SAP Logon Failed
I tried to login to SAP through MMC.
When i click start and give password.
it
Multidimensional array problems in $_POST
I'm having trouble with a three-dimensional $_POST array. It starts as a two-dimensional array on th
Parse error: syntax error, unexpected $end in
hello,
i receive the error :Parse error: syntax error, unexpected $end in C:xamppxampphtdocsh
Getting Resource id #11 while trying to connect..
So i tried using "DEFINE" for the first time and im using the variables i defined to conne
mysqli_fetch_assoc returns multiple arrays, how to return a single array
Hello, I am using mysqli_fetch_assoc which is returning multiple rows, so it looks like:
Code
Why will this program not run if the variables are not global?
Hey guys I have a kind of perplexing situation that is probably simple, but I can't seem to understa
url- go to webpage
i have an input text field and submit button.
how do i make the url entered into the textfiel
Strange HTML Tag?
I recently noticed some odd HTML appear in some of the websites I host. Not all of them are run on a
Splitting Attributes
SQL> SELECT I_NAME, substr(I_NAME,1,instr(I_NAME,'O')) "First part",
substr(I_NAME, IN
Nested (echoed) php running wrong script
Got a problem with a php website I'm creating.
In a nutshell, the first page is entirely html