由于命令不同步,单击按钮时,php表单将不会提交

时间:2013-04-02 16:31:15

标签: php forms command submit sync

以下代码不会将表单提交到页面,即使它应该是。我的表单标签在一个页面中声明,该页面在文件夹层次结构中是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"] . "");
                }
            }
        }
    }

0 个答案:

没有答案
相关问题