I have a dynamic table repeating to show all the records, which is great. I now want to add a drop down box above it to act as a filter so one of our users can select an option from that dropdown to filter the entire table to just what they need.
I added the drop down and a data set and put the DISTINCT so it only shows each option once. That is fine, however now that I try to filter the table, I am running into an issue.
I added this to the SQL in the record set where the table is:
WHERE OEM LIKE 'varOEM'
and this to the variables section:
variable name varOEM
default value of -1
run-time value of $_POST['selOEM']
Any suggestions where to look?
below is more of the code:
<label for="OEM">OEM</label>
<select name="selOEM" id="selOEM" onchange="form1.submit()">
<option value="%">All OEM</option>
<?php
do {
?>
<option value="<?php echo $row_OEMList['OEM']?>"><?php echo $row_OEMList['OEM']?></option>
<?php
} while ($row_OEMList = mysql_fetch_assoc($OEMList));
$rows = mysql_num_rows($OEMList);
if($rows > 0) {
mysql_data_seek($OEMList, 0);
$row_OEMList = mysql_fetch_assoc($OEMList);
}
?>
</select>
submit
<input type="submit" name="submit" id="submit" value="Submit" />
<table border="1">
<tr>
<td>OEM</td>
<td>OEMItemNumber</td>
<td>ShortDescription</td>
<td>ProductType</td>
<td>MachineType</td>
<td>color</td>
<td>PageYield</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_tonerlist['OEM']; ?></td>
<td><?php echo $row_tonerlist['OEMItemNumber']; ?></td>
<td><?php echo $row_tonerlist['ShortDescription']; ?></td>
<td><?php echo $row_tonerlist['ProductType']; ?></td>
<td><?php echo $row_tonerlist['MachineType']; ?></td>
<td><?php echo $row_tonerlist['color']; ?></td>
<td><?php echo $row_tonerlist['PageYield']; ?></td>
</tr>
<?php } while ($row_tonerlist = mysql_fetch_assoc($tonerlist)); ?>
</table>
I added the drop down and a data set and put the DISTINCT so it only shows each option once. That is fine, however now that I try to filter the table, I am running into an issue.
I added this to the SQL in the record set where the table is:
WHERE OEM LIKE 'varOEM'
and this to the variables section:
variable name varOEM
default value of -1
run-time value of $_POST['selOEM']
Any suggestions where to look?
below is more of the code:
<label for="OEM">OEM</label>
<select name="selOEM" id="selOEM" onchange="form1.submit()">
<option value="%">All OEM</option>
<?php
do {
?>
<option value="<?php echo $row_OEMList['OEM']?>"><?php echo $row_OEMList['OEM']?></option>
<?php
} while ($row_OEMList = mysql_fetch_assoc($OEMList));
$rows = mysql_num_rows($OEMList);
if($rows > 0) {
mysql_data_seek($OEMList, 0);
$row_OEMList = mysql_fetch_assoc($OEMList);
}
?>
</select>
submit
<input type="submit" name="submit" id="submit" value="Submit" />
<table border="1">
<tr>
<td>OEM</td>
<td>OEMItemNumber</td>
<td>ShortDescription</td>
<td>ProductType</td>
<td>MachineType</td>
<td>color</td>
<td>PageYield</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_tonerlist['OEM']; ?></td>
<td><?php echo $row_tonerlist['OEMItemNumber']; ?></td>
<td><?php echo $row_tonerlist['ShortDescription']; ?></td>
<td><?php echo $row_tonerlist['ProductType']; ?></td>
<td><?php echo $row_tonerlist['MachineType']; ?></td>
<td><?php echo $row_tonerlist['color']; ?></td>
<td><?php echo $row_tonerlist['PageYield']; ?></td>
</tr>
<?php } while ($row_tonerlist = mysql_fetch_assoc($tonerlist)); ?>
</table>