Hey, everybody, look at this foreigner. Ways to pass elements between pages

Source: Internet
Author: User
Tags count form post urlencode
The way a page passes a parameter on a third party page it does save a little bit of code, at least I've never passed it before.
<%
' Pass form objects submitted by a form G
' ET
If request.querystring.count>0 Then
Qstr= "?"
For each x in Request.QueryString
Qstr = qstr & x & "=" ' Write Name of Parameter
Qstr = qstr & Server.URLEncode (Request. QueryString (x)) & "&" ' Write value of parameter
Next
Qstrsz = Len (qstr)-1
Qstr = Left (Qstr,qstrsz)
Else
Qstr= ""
End If
Response.Redirect ("yoururl.asp" & Qstr)
%>
The Next example shows how to build the submitted parameters from a form POST. The procedure reads all posted objects and builds a querystring parameter.
<%
' Pass form objects submitted by a form G
' ET
If request.form.count>0 Then
Qstr= "?"
For each x in Request.Form
Qstr = qstr & x & "=" ' Write Name of Parameter
Qstr = qstr & Server.URLEncode (Request.Form (x)) & "&" ' Write value of parameter
Next
Qstrsz = Len (qstr)-1
Qstr = Left (Qstr,qstrsz)
Else
Qstr= ""
End If
Response.Redirect ("yoururl.asp" & Qstr)
%>
The Next code example may is used as a test ASP page to redirect. It reads the querystring and builds a table to display the parameter name and value passed.
<%@ Language=vbscript%>
<HTML>
<BODY>
<%
Response.Write "<table border=1><tr><th>parameter</th><th>value</th></tr > "
For each x in Request.QueryString
Response.Write "<TR><TD>" & X & "</TD><TD>" ' Write Name of Parameter
Response.Write Request.QueryString (x) & "</TD></TR>" ' Write value of parameter
Next
Response.Write "</TABLE>"
%>
</BODY>
</HTML>
Of course, the improved version of this thing is much simpler, and look at this.
<%
If
Request.QueryString.Count > 0 Then

Response.Redirect ("Yoururl.asp?" &
Request.QueryString
Else
If
Request.Form.Count > 0 Then

Response.Redirect ("Yoururl.asp?" &
Request.Form)
Else

Response.Write ("No Data Sent")
End
If
End If
%>
Originally can the whole crawl, I also just know, dare not take, took out share



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.