Request.Form保持为空

时间:2019-03-04 16:23:31

标签: c# html css request.form

当我运行它并尝试删除一个帐户时,我会填写输入类型的文本并按“删除”,但是由于某些原因,string txt = Request.Form["thing"]仍然为空

<body>
  <div id="content">
    <div class="search">
      <form runat="server" method="post">
        <div id="things">
          <h5>Username:</h5>
          <input type="text" name="user" placeholder="Enter username" />
          <h5>Password:</h5>
          <input type="password" name="pass" placeholder="Enter username" />
          <h5>Email:</h5>
          <input type="email" name="email" placeholder="Enter username" />
          <div id="btn">
            <input type="submit" id="sub" value="Search" />
            <button type="reset" id="reset" onclick="location.href='Admin.aspx'" id="sebtn1" value="Search">Reset</button>
          </div>
        </div>
        <div id="rem">
          <input type="text" runat="server" id="text" name="thing" placeholder="Enter username to remove" />
          <button type="submit" id="remove">remove</button>
        </div>
      </form>
      <%
        string txt = Request.Form["thing"];
        if(txt != null)
          {
            string sql = "DELETE FROM users WHERE usermame = '" + txt + "'";
            MyDataBase.ExecuteNonQuery(sql);
          }
        string add = "SELECT * FROM users WHERE ";
        string user = Request.Form["user"];
        string pass = Request.Form["pass"];
        string email = Request.Form["email"];
        string counter = "";
      %>

0 个答案:

没有答案