网络编程
位置:首页>> 网络编程>> Asp编程>> ASP网页编程的19个基本技巧(2)

ASP网页编程的19个基本技巧(2)

  发布时间:2023-07-09 11:52:01 

标签:技巧,编程,asp

10.ASP取得表格输入数据的方法:GET POST

一.get:用户端将数据加到URL后,格式为”?字段1=输入数据1&字段2=输入数据2&...",
再将其送到服务器。
如: action为www.aspxhome.com, 字段Name输入数据为jack,字段age的数据为15,则用get方法为
http://www.aspxhome.com?Name=jack&Age=15

二.post:用户端用http信息数据传送到服务器

ASP中:get:使用“输入数据= Request.QueryString("字段名")",将附加于URL的数据取出。post:使用“输入数据=Request.Forml"(字段名")",读取HTTP信息数据字段。
* Request.QueryString范例
如:

<A hery="aspform.asp?Name=jack&Age=15">

按此

〈/A〉〈p〉
Name:<%=request.QueryString("Name")%)
Age:<%=request.QeueryString("Age")%)


* get 范例
·aspturm.asp:

<form action="asp1b.asp" method="get">
姓名: <input type=text name="input1" value="Your name">
<p>
特征: <select name="input2">
<option>cool!
<option>handsome
<option>warmhearted
</select>
<input type=submit value="ok">
</form>
asp1b.asp的内容
<html><body>
<% =request.querystring("input1") %> hi, your character is
<%= request.querystring("input2") %>
</body></html>


11.request.From
语法: request.From(name)[(index)|.count]
name:字段名
index:当同一字段输入多个值时,指针值index指定要读取同一字段的那一个值,范围由1到
request.From(name).count
count:由request.From(name).count可知name字段输入几个值,若无此name字段,count为0


如下例:

<%
forI=1 to request.fron("input1").count
response.write request.From("input1")(I)&"<br>"
next
%>


若input1有两个值则都显示出
*若未采用index指定读取哪个.可用

〈%
for each item request.From("input"))
repomse.write item &"<br>"
next
%>


也可用" for each x in tewuest.From"重复取得所有字段的输入值。

<% for each x in request.Form %>
request.From (<%=x%)=<%=request.Form
(x)%> <br>
<% next %>

12.获取客户端TCP/IP端口的方法:
如: tcp/ip port is <%=request("server_port")%>
使用server_port可以得到接收HTTP request的连接port信息

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com