<form method="post" class="register-form">
 <input type="radio" name="role" id="student" value="student" required>
                    <label for="student">Student</label>
                    <input type="radio" name="role" id="teacher" value="teacher" required>
                    <label for="teacher">Teacher</label>
                    <hr size="1px" width="800px">
                    <div class="student-form">
                        <label for="class">Class</label>
                        <select name="sclass" id="student-class">
                            <option value="" selected disabled hidden>Class</option>
                            <option value="Te">Te</option>
                            <option value="1e">1e</option>
                            <option value="2nd">2nd</option>
                            <option value="3e">3e</option>
                            <option value="4e">4e</option>
                            <option value="5e">5e</option>
                            <option value="6e">6e</option>
                            <option value="7e">7e</option>
                            <option value="8e">8e</option>
                            <option value="9e">9e</option>
                            <option value="10e">10e</option>
                            <option value="11e">11e</option>
                            <option value="12e">12e</option>
                        </select>
                        </div>
                        </form>I have this php that involves 2 radio buttons, if one is pressed [...] (check code). everytime I do though, i echo $sclass for example and i get this error message with all of them : Warning: Undefined variable $sclass in C: on line 424. Any idea why the variable sclass and others aren't getting values assigned to them?
if($_POST['role'] == 'student'){
        $sclass = $_POST['sclass'];
        $ssection = $_POST['ssection'];
    }
    if($_POST['role'] == 'teacher'){
        $tclass1 = $_POST['tclass1'];
        $tsection1 = $_POST['tsection1'];
        $tclass2 = $_POST['tclass2'] ?? $tclass2 = '';
        $tsection2 = $_POST['tsection2'] ?? $tsection2 = '';
    }
 
    