⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asp_inputforms.asp@output=print

📁 W3Schools tutorial..web designing
💻 ASP@OUTPUT=PRINT
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>ASP Forms</title>
 
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />

<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>

<body>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

<h1>ASP Forms and User Input</h1>
<a href="asp_procedures.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="asp_cookies.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<p class="intro">The Request.QueryString and  Request.Form commands may be used to retrieve information from forms, like 
user input.</p>
<hr />

<h2>Examples</h2>
<p><a target="_blank" href="showasp.asp@filename=demo_reqquery">A form with 
method=&quot;get&quot;</a><br />
How to interact with the user, with the Request.QueryString command.</p>

<p><a target="_blank" href="showasp.asp@filename=demo_simpleform">A form with 
method=&quot;post&quot;</a><br />
How to interact with the user, with the Request.Form command.</p>

<p><a target="_blank" href="showasp.asp@filename=demo_radiob">A form with radio buttons</a><br />
How to interact with the user, through radio buttons, with the Request.Form command.</p>
<hr />

<h2>User Input </h2>
<p>The Request object may be used to retrieve user information from forms.</p>
<p><b>Form example:</b></p>
<table class="ex" cellspacing="0" border="1" width="100%">
    <tr>
      <td>
        <pre>&lt;form method=&quot;get&quot; action=&quot;simpleform.asp&quot;&gt;
First Name: &lt;input type=&quot;text&quot; name=&quot;fname&quot; /&gt;
&lt;br /&gt;
Last Name: &lt;input type=&quot;text&quot; name=&quot;lname&quot; /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;
&lt;/form&gt;</pre>
      </td>
    </tr>
</table>
<p>User input can be retrieved in two ways: With Request.QueryString or Request.Form. </p>
<hr />

<h2>Request.QueryString</h2>
<p>The Request.QueryString
command is used to collect values in a form with method=&quot;get&quot;. Information sent from a form with the GET method is visible to everyone 
(it will be displayed in the browser's address bar) and has limits on the amount 
of information to send.</p>
<p>If a user typed &quot;Bill&quot; and &quot;Gates&quot; in the form example
above, the URL sent to the server would look like
this:</p>
<table class="ex" cellspacing="0" border="1" width="100%">
    <tr>
      <td>
        <pre>http://www.w3schools.com/simpleform.asp?fname=Bill&amp;lname=Gates</pre>
      </td>
    </tr>
</table>
<p>Assume that the ASP file &quot;simpleform.asp&quot; contains the following script:</p>

<table class="ex" cellspacing="0" border="1" width="100%">
    <tr>
      <td>
        <pre>&lt;body&gt;
Welcome 
&lt;%
response.write(request.querystring(&quot;fname&quot;))
response.write(&quot; &quot; &amp; request.querystring(&quot;lname&quot;))
%&gt;
&lt;/body&gt;</pre>
      </td>
    </tr>
</table>
<p>The browser will display the following in the body of the document:</p>
<table class="ex" cellspacing="0" border="1" width="100%">
    <tr>
      <td>
        <pre>Welcome Bill Gates</pre>
      </td>
    </tr>
</table>
<br />
<hr />

<h2>Request.Form </h2>
<p>The Request.Form
command is used to collect values in a form with method=&quot;post&quot;. Information sent from a form with the POST method 
is invisible to others and has no limits on the amount of information to send.</p>
<p>If a user typed &quot;Bill&quot; and &quot;Gates&quot; in the form example
above, the URL sent to the server would look like
this: </p>
<table class="ex" cellspacing="0" border="1" width="100%">
    <tr>
      <td>
        <pre>http://www.w3schools.com/simpleform.asp</pre>
      </td>
    </tr>
</table>
<p>Assume that the ASP file &quot;simpleform.asp&quot; contains the following script:</p>

<table class="ex" cellspacing="0" border="1" width="100%">
    <tr>
      <td>
        <pre>&lt;body&gt;
Welcome 
&lt;%
response.write(request.form(&quot;fname&quot;))
response.write(&quot; &quot; &amp; request.form(&quot;lname&quot;))
%&gt;
&lt;/body&gt;</pre>
      </td>
    </tr>
</table>
<p>The browser will display the following in the body of the document:</p>

<table class="ex" cellspacing="0" border="1" width="100%">
    <tr>
      <td>
        <pre>Welcome Bill Gates</pre>
      </td>
    </tr>
</table>
<br />
<hr />

<h2>Form Validation</h2>
<p>User input should be validated on the browser whenever possible (by client scripts).
Browser validation is faster and you reduce the server load.</p>
<p>You should consider using server validation if the user input will be
inserted into a database. A good way to validate a form on the server is to post
the form to itself, instead of jumping to a different page. The user will then
get the error messages on the same page as the form. This makes it easier to
discover the error.</p>
<hr />
<a href="asp_procedures.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
 <a href="asp_cookies.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -