Geordieboy99 Posted May 12, 2007 Share Posted May 12, 2007 Hello I am trying to do a drop drown box query where if you select a certain game type then the records in the database that have that game type are displayed in a table below. My drop boxs work fine, its the query to display the data that is troubling me. Here is my code so far. <?php include("connection.inc.php"); $connection = connect(); $types = $_POST['types']; if ($types == 'type') { $query = "SELECT * FROM tblgame WHERE type='$types'"; $result = mysql_query($query); while ($record = mysql_fetch_object ($result)) { print "<tr>"; print "<td>$record->name</td>"; print "<td>$record->type</td>"; print "<td>$record->supination</td>"; print "<td>$record->pronation</td>"; print "<td>$record->elbowextension</td>"; print "<td>$record->wristextension</td>"; print "<td>$record->thumbextension</td>"; print "<td>$record->shoulderflexion</td>"; print "<td>$record->description</td>"; print "</tr>"; } } ?> types is the name I gave to my drop down box. type is the field in the database. Thanks for any help in advance. Quote Link to comment https://forums.phpfreaks.com/topic/51050-help-with-drop-down-box-query/ Share on other sites More sharing options...
Barand Posted May 12, 2007 Share Posted May 12, 2007 The only obvious thing is no table tags <table> content of table here </table> But if it's not that, it would help if you gave us more than "it's not working" Quote Link to comment https://forums.phpfreaks.com/topic/51050-help-with-drop-down-box-query/#findComment-251229 Share on other sites More sharing options...
Geordieboy99 Posted May 12, 2007 Author Share Posted May 12, 2007 my table is later on in the page and looks like this. <table width="800" border="1"> <tr> <td>Name</td> <td>Type</td> <td>Supination</td> <td>Pronation</td> <td>Elbow Extension </td> <td>Wrist Extension </td> <td>Thumb Extension </td> <td>Shoulder Flexion </td> <td>Description</td> </tr> </table> I am getting an undefined index on line 4 which relates to this line. $types = $_POST['types']; Quote Link to comment https://forums.phpfreaks.com/topic/51050-help-with-drop-down-box-query/#findComment-251309 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.