My SQL table has 8 columns 1. ID, 2. brand, 3. model, 4. type, 5. OEM, 6. description, 7. mono_yield, 8. colour_yield
I have 3 drop downs and I wish to populate the second one according to the first and third one according to the first and second.
1: Printer Brand
2. Printer Model
3. Printer Type
Here’s the code:
/*
- Populate form filter
*/
$stmt = $db->query(‘SELECT * FROM printers GROUP BY type ORDER BY type ASC’);
if($stmt === false) {
echo ‘<p>Unable to populate required data to build page.</p>’;
exit;
}
while($row=$stmt->fetch(PDO::FETCH_ASSOC)) {
$tpl[‘filter’][‘type’][‘#values’] = array(
‘label’ => $row[‘type’]
,‘value’ => $row[‘type’]
,‘selected’ => isset($_GET[‘filter’],$_GET[‘filter’][‘type’]) && $_GET[‘filter’][‘type’] == $row[‘type’]
);
}
/*
I have no idea how to get all three working together.
Any help greately apprciated.