1

以下代码不会将表单提交到页面,即使它应该这样做。我的表单标签在文件夹层次结构中向上 2 层的页面中声明,我制作它以便它能够与层次结构中向下 2 层的代码进行通信。我的表单方法是post。此代码不会运行,因为命令不同步,我无法运行该命令。

public function getStudents()
    {
        $studentList = mysql_query("CALL GetLogin();")
        or die(mysql_error());
        $studentRows = mysql_num_rows($studentList);
        $counter = 1;

        while ($row = mysql_fetch_array($studentList))
        {
            echo '<tr>
            <td colspan="3"><center>
            <input type="checkbox" name="myselectedstudent' . $counter . '" value="' . $row["username"] . '">' . $row["username"] . '<br>
            </center></td>
            </tr>';
            $counter++;
        }
        echo '<tr>
        <td align="center" colspan="3"><br/><strong>
        <input type="submit" name="Submit" value="Confirm Student">
        </strong></td>
        </tr>';
        $counter = 0;

        while ( $counter <= $studentRows )
        {
            $counter++;
            if ( isset($_POST['myselectedstudent' . $counter . '']) )
            {
                $_SESSION["Student"] = $_POST['myselectedstudent' . $counter . ''];
                $this->getAllAssignedStudents( $_SESSION["Student"], $_SESSION["testName"], $_SESSION["user"] );

                if ( $counter == $studentRows )
                {
                    echo '<script language="javascript">
                    alert ( "Students Added!" );
                    </script>';
                    Header
                    ("Location: http://localhost/AndrewPHP/Greenboard/PresentationLayer/mainpageGUI.php?PageID=" . $_SESSION["accessLevel"] . "");
                }
            }
        }
    }
4

0 回答 0