PHP页面上的第二个表单不会运行

时间:2016-01-17 22:07:08

标签: php sql forms

我在页面上有两个表单。当我运行第一个时,它按预期工作,但第二个,尽管有不同的表单ID和所有被命名的元素,将不会(它试图运行第一个表单,我认为,但没有元素被发布它将返回没有结果)。

第二种形式是在"角色"部分。

以下是代码 - 感谢任何帮助!

/***** Section: Rights *****/
echo '

        <!-- div: Edit -->
        <div id="dashboardPanelWrapper">
            <div id="sectionArrow"></div>
            <div id="dashboardPanelTitle">User rights and privileges</div>
            <div id="dashboardPanelContent">';


            echo "<div id='DV_simple_wrapper_wide'>";

            echo "<table width='60%'><tr><th>Role</th><th>Staff</th><tr>";
            $query = "SELECT DISTINCT rightName FROM ".$dbName.".rights WHERE siteLimit='gpvwc' AND rightName!='ADMIN' ORDER BY rightName ASC";
            $result = mysql_query($query);
                while ($row = mysql_fetch_row($result)) {
                    $role=$row[0];

                    echo "<tr><td>$role</td><td>";

                //  $query2= "SELECT userId FROM ".$dbName.".rights WHERE rightName='$role' AND siteLimit='gpvwc'";
                    $query2 = "SELECT CONCAT (u.firstName, ' ',u.lastName) AS username, r.head FROM ".$dbName.".rights r LEFT JOIN ".$dbName.".users u ON r.userId=u.id WHERE r.rightName='$role' AND r.siteLimit='gpvwc' ORDER BY r.head DESC, username ASC";
                    $result2 = mysql_query($query2);
                        while ($row = mysql_fetch_row($result2)) {
                            $name=$row[0];
                            $head=$row[1];
                            if ($head=='1') { $name="<b>$name, </b>"; }
                            if ($head=='0') { $name="$name, "; }
                            echo "$name";
                        }
                        echo "</td></tr>";
                }
            echo "</table>";    

            echo "<form id='1' action='' method='post'>";

            $usersAsArray = $user->listUsers($banned=false);

            echo '<div id="defButtonWrapperH">';
            echo '<select id="DriverAppealEvent" class="defSelectV" style="min-width: 70px; margin-bottom: 10px;"  onchange="submitTarget(this.value);">';
                echo '<option value="0">--</option>';

                foreach ($usersAsArray as $key => $value) {
                    echo '<option value="'.$key.'"';
                        if (isset($target) && $target == $key)
                            echo 'selected';
                    echo '>'.$value.'</option>';
                }

            echo '</select>';
            echo '</div>';
            echo '<p>&nbsp;</p>';
            echo '<p>&nbsp;</p>';

            $userToEdit = false;
            if ($target) {
                $userToEdit = $user->userToView($target);
                // Check if any rights given for this user and update form if any
                $query = "SELECT u.*, r.rightName, r.countryLimit, r.siteLimit, r.isActive, r.head FROM ".$dbName.".users u
                LEFT JOIN ".$dbName.".rights r ON r.userId=u.id WHERE u.id=".$target;

                $result = mysql_query($query);
                while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                    if ($row['rightName'] != '') {
                        $userToEdit['rights'][] = array(
                            'rightName' => $row['rightName'],
                            'rightCountryLimit' => $row['countryLimit'],
                            'rightSiteLimit' => $row['siteLimit'],
                            'rightIsActive' => $row['isActive'],
                            'rightHead' => $row['head']
                        );
                    }
                }
                mysql_free_result($result);

                // If the user has rights then write a table with all them plus options to revoke
                if (!empty($userToEdit['rights'])) {
                    drawUserRightsTable($userToEdit);
                }
            echo "</form>";
                // Draw selector with rights here so we can add new rights to this user

                $useradd=$userToEdit['id'];

                echo "<form id='addadmin' action='$RKP/kernel/lib/php_lib/action/AC_Admins.php?op=add&user=$useradd' method='post'>";
                echo "Role: <select name='role'>";
                $query = "SELECT DISTINCT rightName FROM ".$dbName.".rights WHERE rightName!='ADMIN' ORDER BY rightName ASC";
                $result = mysql_query($query);
                while ($row = mysql_fetch_row($result)) {
                    $righttoadd=$row[0];

                    echo "<option value='$righttoadd'>$righttoadd</option>";
                }
                echo "</select></br>";
                echo "Head: <input type='radio' name='head' value='0' checked> No <input type='radio' name='head' value='1'> Yes";
                echo "<p>&nbsp;</p>";
                MODW_Buttons_Button(Normal,Normal,Normal,Normal,None,$RKP,$id,BGenSu,$intern,$intcont);
                echo "</form>";

                //echo '<pre>';print_r($userToEdit);echo '</pre>';
            }

            echo "</div>";

echo '      </div>
        </div>';


/***** Section: Roles *****/
echo '

        <!-- div: Edit -->
        <div id="dashboardPanelWrapper">
            <div id="sectionArrow"></div>
            <div id="dashboardPanelTitle">Disciplinary Committee Roles</div>
            <div id="dashboardPanelContent">';

            echo "<div id='DV_simple_wrapper_wide'>";

            echo "<table width='60%'><tr><th>Series</th><th>Staff</th><th>&nbsp;</th><tr>";
            $query = "SELECT id, compName FROM ".$dbName.".competitions WHERE active='1' AND id!='10' ORDER BY id ASC";
            $result = mysql_query($query);
                while ($row = mysql_fetch_row($result)) {

                    $compid=$row[0];
                    $compName=$row[1];

                    echo "<tr><td><b>$compName</b></td><td>";

                //  $query2= "SELECT userId FROM ".$dbName.".rights WHERE rightName='$role' AND siteLimit='gpvwc'";
                    $query2 = "SELECT CONCAT (u.firstName, ' ',u.lastName) AS username, r.role, u.id, r.series FROM ".$dbName.".DC_roles r LEFT JOIN ".$dbName.".users u ON r.user=u.id WHERE r.series='$compid' ORDER BY username ASC";
                    $result2 = mysql_query($query2);
                        while ($row = mysql_fetch_row($result2)) {
                            $name=$row[0];
                            $role=$row[1];
                            $userid=$row[2];
                            $seriesid=$row[3];
                            if ($role=='1') { $name="<i>$name</i>"; }
                            if ($role=='0') { $name="$name"; }
                            echo "$name <a href='$RKP/kernel/lib/php_lib/action/AC_Admins.php?op=DelDCRights&user=$userid&comp_id=$seriesid'><b>X</b></a></br>";
                        }
                        echo "</td></tr>";
                }
            echo "</table>";    
            echo "</div>";

            echo "<form id='dcroles' action='$RKP/kernel/lib/php_lib/action/AC_Admins.php?op=AddDCRights' method='post'>";
            echo "User: <select id='userDC' name='userDC'>";
            $query1 = "SELECT id, firstName, lastName FROM ".$dbName.".users ORDER BY lastName ASC, firstName ASC";
            $result1 = mysql_query($query1);
            while ($row = mysql_fetch_row($result1)) {
                $DCuserId=$row[0];
                $DCfirstName=$row[1];
                $DClastName=$row[2];

                echo "<option value='$DCuserId'>$DClastName, $DCfirstName</option>";
            }
            echo "</select></br>";
            echo "</br>";
            echo "Series: <select id='seriesDC' name='seriesDC'>";
            $query = "SELECT id, compName FROM ".$dbName.".competitions WHERE active='1' AND id!='10' ORDER BY id ASC";
            $result = mysql_query($query);
            while ($row = mysql_fetch_row($result)) {
                $DCcompId=$row[0];
                $DCcompName=$row[1];

                echo "<option value='$DCcompId'>$DCcompName</option>";
            }
            echo "</select></br>";
            echo "Third Checker: <input type='radio' id='head' name='head' value='0' checked> No <input type='radio' name='head' value='1'> Yes</br>";
            echo "<input type='submit' value='Submit'>";
            echo "</form>";

0 个答案:

没有答案