drop down menu in table

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
justforfun
Posts: 22
Joined: Thu Nov 07, 2013 9:35 pm

drop down menu in table

Post by justforfun »

hey guys struggling a little here i have a table showing:
Edit: all the retrieval code is there too for reference

Code: Select all

print "<center><br><h3>Rest & Rehab</h3></center>";
      print "<center>";
      print "<table border='0' width='70%' cellspacing='20'>";
      print "<tr><td width='25%' valign='top'>";
      print "</td>";
      print "<td valign='top' width='75%'>";
      print "<table border='1' bordercolor='black' bgcolor='#ffffff' >";
      print "<tr><td>Name<font color='ffffff'>_________________</td><td>Rating<font color='ffffff'>___</td>
      <td>Development<font color='ffffff'>_</td><td>stamina<font color='ffffff'>_____</td></tr>";
      print "<tr><td>Rest</td>
      <td>$playerinfo3[rating]</td><td><select><option>$ainfo3[name] $ainfo3[level] $ainfo3[cost]</option></select></td><td>$playerinfo3[stamina]%</td></tr>";
      print "<tr><td>Rear Wing</td>
the part i am struggling with is:
<select><option>$ainfo3[name] $ainfo3[level] $ainfo3[cost]</option></select>

what i am trying to do is create a drop down menu in my table whilst restricting the data received it is showing the corresponding information but only one in the list not both

so for instance in phpmyadmin
i have:
name id level price
Rest 1 2 20
Sleep 1 3 40
Chill 2 2 20
lounge 2 3 40

i want to only see items on this list where id=1 and the corresponding name and price of the action.
User avatar
Xaos
Posts: 946
Joined: Wed Jan 11, 2012 4:01 am

Re: drop down menu in table

Post by Xaos »

I think you have to pull all of the things in the DB where Id = 1 then have a loop to put them into drop downs. I'd probably put them into an array or temp. Variables after pulling them from the DB.
justforfun
Posts: 22
Joined: Thu Nov 07, 2013 9:35 pm

Re: drop down menu in table

Post by justforfun »

thats it, racking my brain bout that lol
User avatar
Xaos
Posts: 946
Joined: Wed Jan 11, 2012 4:01 am

Re: drop down menu in table

Post by Xaos »

justforfun wrote:thats it, racking my brain bout that lol
Haha. Did you get it working?
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: drop down menu in table

Post by hallsofvallhalla »

i am not sure what you need here but it seem like

document.getElementById('DropDownItem').selectedIndex, then just pass that to your DB to restrict the items by list.
justforfun
Posts: 22
Joined: Thu Nov 07, 2013 9:35 pm

Re: drop down menu in table

Post by justforfun »

no but sorted it now the way that I was doing it would be easy to manipulate so changed it and now it is complete

10 codes downv 58 to go lol
Post Reply

Return to “Advanced Help and Support”