This seems like an easy one, but I just can't figure it out. I have a simple table, and two queries on the same page. Each query looks for a different field to pull records from. Upon first opening the page, the entire list of records from the first query is displayed. The other query seems to be working fine, only displays results on string value selection. What am I missing?
The code:
$sub_type=$POST["sub_type"];
$sub_type_e=$POST["sub_type_e"];
$result = mysql_query("SELECT from case_studies where sub_type = '$sub_type' ORDER BY name ASC ");
$result2 = mysql_query("SELECT from case_studies where sub_type_e = '$sub_type_e' ORDER BY name ASC ");
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select id=ent name="sub_type_e" size="1" onchange="this.form.submit();" >
<option value="<?=$sub_type_e?>" selected><?php echo "<h4> $sub_type_e </h4>" ; ?></option>
<option value="Improv Comedy">Improv Comedy</option>
<option value="Sketch Comedy">Sketch Comedy</option>
<option value="Guest Speakers">Guest Speakers</option>
<option value="Corporate Comedy">Corporate Comedy</option>
<option value="Corporate Imposters">Corporate Imposters</option>
<option value="Emcee ¦ Host">Emcee ¦ Host</option>
<option value="Video Productions">Video Productions</option>
<option value="Corporate Events">Corporate Events</option>
</select>
</form>
<?php ($row = mysql_fetch_array($result2))?>
<table width="120" border=0 class="table" cellpadding="2">
<tr>
<td align="left">
<a href="<?=$row[5]?>"><?=$row[2]?></a>
</td>
</tr>
<?
while ($row = mysql_fetch_array($result2))
{
?>
<tr>
<td align="left">
<a href="<?=$row[5]?>"><?=$row[2]?></a>
</td>
</tr>
<?
}
?>
</table>
Training:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select id=train name="sub_type" size="1" onchange="this.form.submit();" >
<option value="<?=$sub_type?>" selected><?php echo "<h4> $sub_type </h4>" ; ?></option>
<option value="Communication">Communication</option>
<option value="Executive Coaching">Executive Coaching</option>
<option value="Interview Skills">Interview Skills</option>
<option value="Leadership">Leadership</option>
<option value="Mediation">Mediation</option>
<option value="Presentation">Presentation</option>
<option value="Sales ¦ Bus Dev">Sales ¦ Bus Dev</option>
<option value="Team Building">Team Building</option>
<option value="Workplace Productivity">Workplace Productivity</option>
</select>
</form>
<?php ($row = mysql_fetch_array($result))?>
<table width="120" border=0 class="table" cellpadding="2">
<tr>
<td align="left">
<a href="<?=$row[5]?>"><?=$row[2]?></a>
</td>
</tr>
<?
while ($row = mysql_fetch_array($result))
{
?>
<tr>
<td align="left">
<a href="<?=$row[5]?>"><?=$row[2]?></a>
</td>
</tr>
<?
}
?>
</table>
Any help is much appreciated.