Page 1 of 1

drop down menu in table

Posted: Fri Nov 08, 2013 2:43 am
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.

Re: drop down menu in table

Posted: Fri Nov 08, 2013 1:36 pm
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.

Re: drop down menu in table

Posted: Fri Nov 08, 2013 4:37 pm
by justforfun
thats it, racking my brain bout that lol

Re: drop down menu in table

Posted: Fri Nov 08, 2013 5:07 pm
by Xaos
justforfun wrote:thats it, racking my brain bout that lol
Haha. Did you get it working?

Re: drop down menu in table

Posted: Fri Nov 08, 2013 6:40 pm
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.

Re: drop down menu in table

Posted: Fri Nov 08, 2013 11:01 pm
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