Jump to content

Help with drop down box query


Geordieboy99

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/51050-help-with-drop-down-box-query/
Share on other sites

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'];

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.