How am I able to allow the second query in this snippet to pass the value from the first selection onchange to the next? whenever I put the variable in the query, it does not recognize the change, but if I manually code the where clause, it works:
<?php
$conn = new mysqli("localhost", "root", "", "kevvskustomsdb");
$sql = mysqli_query($conn, "SELECT Device FROM devicetype");
?>
<form action="">
<label id="level3-label" for="device-repair-type">Device to be Repaired</label><br>
<select id="device-repair-type" name="selectform">
<?php
while ($row = $sql->fetch_assoc()){
$device = $row['Device'];
echo "<option value='$device'>$device</option>";
}
?>
</select><br>
<label>Device Model</label><br>
<select id="device-model" name="selectform">
<?php
echo "hello";
$receiveDrop = $_POST[$device];
if(isset( $receiveDrop ))
{
$sql1 = mysqli_query($conn, "SELECT Device FROM phonedata WHERE typeOfdevice = '$device'");
while ($row1 = $sql1->fetch_assoc()){
$device1 = $row1['Device'];
echo "<option value='$device1'>$device1</option>";
}
}
?>
</select><br>
<label>Repair Type</label><br>
<select id="repair-type-2" name="selectform">
<option value="Select">Test</option>
<option value="Custom Computer">Test</option>
<option value="Repair">Test</option>
<option value="Repair">Test</option>
</select><br>
<div class="button-css">
<input id="submitbutton-repair-form" type="submit" value="Submit">
</div>
</form>
I tried passing and using _post, but could not get it to function. I will also be using the same solution for the third drop-down as well.
Thank you!