如何在发布前更新用户条目表单

I'm trying to make the user choose from a checkbox then display the right list to him.

here is my code:

    qualification: <select name="qualification">
    <option value="ET">ET</option>
    <option value="TM">TM</option>
</select><br> 
current registration: <input type="checkbox" name="classRegular" value="RegularClass">Regular Class<br>
    <input type="checkbox" name="classTaahdoh" value="Taahdoh">Taahdoh<br>

    <?php
    $selectedQualification = $_POST['qualification'];  // Storing Selected Value In Variable

    if(isset($_POST['classRegular'])){

      if ( $selectedQualification == "ET") {
        echo 'Class: <select name="regularClass">';
        $sql = "SELECT idClass FROM Class Where category = 'ET' ";
        $result = $conn->query($sql);

        if ($result->num_rows > 0) {
          //output data of each row in dropdown list
          while($row = $result->fetch_assoc()) {
            echo "<option value='{".$d['idClass']."}'>".$d['idClass']."</option>";
          }
        } else {
          echo '0 results';
        }
    ?>

It doesn't show the list after the user check the type of class, is it because I check with 'POST' ? What other options I can do?

Any help please?

If you want to display list after the user checks the type of class, please remove

if(isset($_POST['classRegular'])) {

if block from code. Then list of answers will be displayed every time.

1.There is no way to send the result to the page.Unless you use a submit button or ajax

2.There is no connection to the database.

So add something like this code :

<?php

define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', 'yourpassword');
define('DB_NAME', 'yourwebsite');

/* Attempt to connect to MySQL database */
try{
    $pdo = new PDO("mysql:host=" . DB_SERVER . ";dbname=" . DB_NAME, DB_USERNAME, DB_PASSWORD);
    // Set the PDO error mode to exception
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e){
    die("ERROR: Could not connect. " . $e->getMessage());
}
?>

Also, used prepared statements.Yes you aren't directly accepting user inpuit but a malicious user could still inspect the page and change the value of the option to a dangerous one