Jump to content

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.