I am using PHP to design an interactive website. First, I designed three dropdown lists.
Say if a user picks a, b, c for each list. Then, I need to withdraw data from a database called S.
I want it first draw *table a** from database S and then the columns b and c from that table a.
I set q1, q2, and q3 as the value for the user picks in the dropdown list, but have no idea how to use them in the next step. Thanks for your help in advance!
Below is my code. I want to open Month column (q) in the Age Table.
$q = 'Month';
$sql = 'SELECT "$q" FROM Age';
$query = mysqli_query($conn, $sql);
if (!$query) {
die ('SQL Error: ' . mysqli_error($conn));
}
echo '<table><thead><tr><th>".$q."</th></tr></thead><tbody>';
while ($row = mysqli_fetch_array($query)){
echo '<tr> <td>'.$row["$q"].'</td> </tr>';
}
echo '</tbody> </table>';