If you're basing a query off of a selected value, you will need to use a multi-step form to submit the data and pass off to the next form. So the chain will be a very large set of if statements to assemble the form and provide which step it is on.
Effectively, you'll need to branch check each step:
$iStep = isset($_GET['step']) ? (int)$_GET['step'] : 0;
if ($iStep >= 1)
// get data for the next input
if ($iStep >= 2)
// get data for the third input
//. . .
And add the step to the form action (or you can post it and use a hidden input, either way). The fun part will be that you need to check inside of the steps if another input is set so you can add the selected option for the form.