Button 一个页面中有两个提交按钮的bug

Button 一个页面中有两个提交按钮的bug,button,submit,Button,Submit,我是一名学生,正在使用。 在我的管理员页面中,我有一个bug。i、 首先,它提示输入 -->Hall ticket No -->Semester of the particular student. 每当管理员输入这些详细信息并单击firstsubmit按钮时,就会在文本框中显示特定学生的分数。 如果分数不可用,它会显示空文本框,管理员可以在这些文本框中插入该特定学生的分数。 每当他单击第二个提交按钮时输入标记后,必须将标记插入数据库表中。 注意:标记和第二次提交按钮仅在管理员通

我是一名学生,正在使用。 在我的管理员页面中,我有一个bug。i、 首先,它提示输入

-->Hall ticket No 
-->Semester of the particular student.
每当管理员输入这些详细信息并单击firstsubmit按钮时,就会在文本框中显示特定学生的分数。
如果分数不可用,它会显示空文本框,管理员可以在这些文本框中插入该特定学生的分数。
每当他单击第二个提交按钮时输入标记后,必须将标记插入数据库表中。
注意:标记和第二次提交按钮仅在管理员通过电子邮件点击第一次提交按钮时出现。
错误是当我用主题标记填充文本框并单击第二个提交按钮时 它正在为表中的所有主题插入“0”,而不是在文本框中输入标记。 这是我的代码:

<html>
         <body bgcolor="#abcdfg">
            <center><h2>WELCOME TO ADMINISTRATOR</H2>
                   <form name="admin" action="admin1.php" method="POST">
                  Hall Ticket No.:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="text" name="rno" value=""/>
                      <br>
                      <br>
                       Enter The Semister:
                    <input type="text" name="sem" value=""/>
                        <br>
                             <br>
                       <input type="submit" name="submit1" value="Load the marks">
                          </form>


                     <?php
                  if(isset($_POST['submit1']))
                  {
                  $id=$_POST['rno'];
                  $semester=$_POST['sem'];
                  $link = mysql_connect('127.0.0.1', 'root', '');


                           if (!$link) {
                                  die('Could not connect: ' . mysql_error());
                                                 }


                $db_selected = mysql_select_db('etudient', $link);
                        if (!$db_selected) {
                               die ('Can\'t use etudient : ' . mysql_error());
                               }
  $sql='SELECT *
                               FROM `2-1`
                               WHERE id='."'".$id."'";
                               $result=mysql_query($sql);

                             if (mysql_num_rows($result)==0)
                               {
                               echo 'marks were not entered for '.$id.' in '.$semester. ' semester'.'<br>'; 
                                    $empty='SELECT subname
                               FROM `2-1subjects`';


                               $eresult=mysql_query($empty);
                               if(!$eresult)
                        {
                        die('invalid Query:'.mysql_error());
                        }
                        Print "<table border=0 cellpadding=10>"; 
                        //Print "<th>SUBJECT CODE</th>";
                        Print "<th>SUBJECT NAME</th>";
                        Print "<th>MARKS</th>";
                        while($cow = mysql_fetch_array($eresult))
                                {
                                      Print "<tr>";
                                //Print "<td>".$row['subcode'] . "</td> ";
                                print "<td>".$cow['subname'] . "</td> ";
                                //Print "<td>".$row['marks'] . "</td> "; 
                                ?>
                                <form method="POST">
                            <td> <input type="text" name="mark" style="text-align:center" value=""/></td>
                            </form>
                                <?php
                                Print "</tr>";                              
                                   }
                                  Print "</table>"; 
                                  ?>

                                   <input type="submit" name="submit2" value="Insert Marks"/>

                                   <?php
                                     if(isset($_POST['submit2']))
                                        {
                                          $insq='SELECT subcode
                                           FROM `2-1subjects`'; 
                                            if(!$insq)
                                          {
                                          die('invalid Query:'.mysql_error());
                                          }                                        

                                          $insre=mysql_query($insq);
                                          while($subrow=mysql_fetch_array($insre))
                                          {
                                          $mr=$_POST['mark'];
                                          $inser='INSERT into `2-1`(id,subcode,marks)
                                          VALUES('."'".$id."'".','
                                                  ."'".$subrow['subcode']."'".','
                                                  ."'".$mr."'".')';
                                          $inseresult=mysql_query($inser);
                                          if(!$inseresult)
                                          {
                                          die('invalid Query:'.mysql_error());
                                          }
                                          }
                                            echo "successfully Inserted.";

                                        }
                                        else{
                                        echo 'not submitted.';
                                        }

                                }



                               else
                               {
                               echo 'Marks Details of  '.$id.'   in  '.$semester.'  semester'.'<br>';
                               $query='SELECT subname,marks
                               FROM `2-1subjects`
                               JOIN `2-1`
                               ON `2-1subjects`.subcode=`2-1`.subcode
                               WHERE id='."'".$id."'";

                               $sql=mysql_query($query);
                               if(!$sql)
                        {
                        die('invalid Query:'.mysql_error());
                        }
                        Print "<table border=0 cellpadding=10>"; 
                        //Print "<th>SUBJECT CODE</th>";
                        Print "<th>SUBJECT NAME</th>";
                        Print "<th>MARKS</th>";
                        while($row = mysql_fetch_array($sql))
                                {
                                      Print "<tr>";
                                //Print "<td>".$row['subcode'] . "</td> ";
                                print "<td>".$row['subname'] . "</td> ";
                                //Print "<td>".$row['marks'] . "</td> "; 
                                ?>

                            <td> <input type="text" style="text-align:center" value="<?php echo $row['marks'] ?>" /></td>
                                <?php
                                Print "</tr>";                              
                                   }
                                  Print "</table>"; 
                                  print '<input type="submit" name="submit" value="Update Marks"/>';
                                  }

欢迎来到管理员
门厅票号:


输入Semister:


首先,代码中有拼写错误。您的sql查询被定义为insre,您稍后将其称为inser。不,实际上是$insre,用于存储查询主题代码(即子代码)的查询结果。$inser保存用于将标记插入表的查询字符串。根本没有拼写错误。所以,别糊涂了,有人能回答我的问题吗?