我要检查文本字段 [英] I Want to Check Text Field
问题描述
我在HTML和ASP初学者,当用户名和密码都是admin和用户点击该按钮,程序会打开一个新的ASP页我应该写一个程序,否则程序将显示在表无效的用户名或密码。
I am a beginner in HTML and ASP and I should write a program that when username and password are admin and user click on the button, the program opens a new ASP page in otherwise the program shows invalid username or password in table.
在我写这篇code,但总是当我点击按钮,程序将显示新的ASP页面!
我写在记事本该code。
I write this code but always when I click on the Button, the program shows new ASP page! I write this code in notepad.
<html>
<body>
<form method="post" action="Exam1.asp">
<table cellpadding="20" border="1" align="center" style="text-align:left;">
<colorgroup>
<col style="background-color:pink">
<col style="background-color:pink">
</colorgroup>
<tr>
<td>
<p>UserName:</p>
<p>Password:</p>
</td>
<td>
<input type="text" name="Username">
<br>
<br>
<input type="password" name="Password">
</td>
</tr>
<tr>
<td><input type="submit" value="Button"></td>
<td>
<%If Session("Username")="admin"&Session("Password")="admin" Then%>
<form method="post" action="Exam1.asp">
</form>
<%Else%>
Invalid username or password.
<%End If%>
</td>
</tr>
</table>
</form>
</body>
</html>
感谢您的帮助。
干杯
Thanks for help. Cheers
推荐答案
当你点击一个名为提交按钮按钮
,它会带你到 Exam1.asp
并发送该信息的用户输入到表格。 雪村(用户名)
和雪村(密码)
还没有在code定义,但该用户键入 Exam1.asp
,他们将保持数据。
When you click on the submit button named Button
, it will take you to Exam1.asp
and send it the information the user typed into the form. Sesson("Username")
and Sesson("Password")
are not yet defined in your code, but in Exam1.asp
they will hold the data that the user typed.
这篇关于我要检查文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!