The code below runs and populates a dropdown. The 2nd, 3rd, and 4th query also populate a dropdown, just not in this example. I want to take what is chosen in the first dropdown and filter the data from the other 3. Here is the PHP:
<?php
require_once('conn.php');
include '_menu.php';
//Get Processes
$smt = $stamp->prepare('SELECT tblProcess.PID, tblProcess.pName
FROM tblProcess
WHERE tblProcess.pActive=1
ORDER BY tblProcess.pOrder');
$smt->execute();
$data = $smt->fetchAll();
//Get Categories
$smt1 = $stamp->prepare('SELECT tblCategory.CID, tblCategory.PID, tblCategory.cName
FROM tblCategory
WHERE (((tblCategory.cActive)=1))
ORDER BY tblCategory.cOrder;');
$smt1->execute();
$data1 = $smt1->fetchAll();
//Get SubCategories
$smt2 = $stamp->prepare('SELECT tblCategorySub.CSID, tblCategorySub.CID, tblCategory.PID, tblCategorySub.csName
FROM tblCategory INNER JOIN tblCategorySub ON tblCategory.CID = tblCategorySub.CID
WHERE (((tblCategorySub.csActive)=1))
ORDER BY tblCategorySub.csOrder;');
$smt2->execute();
$data2 = $smt2->fetchAll();
//Get Cause
$smt3 = $stamp->prepare('SELECT tblCause.CauseID, tblCause.caName
FROM tblCause
WHERE (((tblCause.caActive)=1))
ORDER BY tblCause.caSortOrder');
$smt3->execute();
$data3 = $smt3->fetchAll();
?>
Here is the HTML that populates one dropdown. I only included one to shorten this question.
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<script src="../script/_DDDisable.js"></script>
<title></title>
</head>
<body>
<div id="header">
<p id="name">STAMPING TROUBLE REPORT</p>
<a href="mailto:[email protected]"><p id="email"></p></a>
</div>
<div class="right">
<h5>Process   <select class="form-control" name="Process" id="Process">
<option value="select">--Select Process--</option>
<?php foreach ($data as $row): ?>
<option value=$row[PID]><?=$row["pName"]?></option>
<?php endforeach ?></select></h5>
</div>
</body>