Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: get the value of parameter passing


Message #1 by "Cheng Kok Wai" <kwcheng@i...> on Tue, 16 Jul 2002 16:16:27 +0800
hi. how do i get the value of A&W from the code below? thanks.

<html>
<head>
<title>How To Get A&W Value</title>
</head>

<body>
<form method="post" name="frm">
<a
href="javascript:location.href='getvalue.asp?Action=GetValue&Name=Bobby&Gend
er=Male&Age=30&FavFood=A&W'">Click To See Bobby Bio</a>
<%
If Request("Action") = "GetValue" Then
Response.write "<br>Name is " & Request("Name")
Response.write "<br>Gender is " & Request("Gender")
Response.write "<br>Age is " & Request("Age")
Response.write "<br>Favourite Food is " & Request("FavFood") 'how to get the
value A&W here?
End If
%>
</form>
</body>
</html>

Message #2 by kyle.b.willman@u... on Tue, 16 Jul 2002 06:58:38 -0500
When passing variables, especially string variables through the URL, it is
always best to wrap each in the function Server.URLEncode(varname).  If you
passed the variable in this example using this, your URL will now look
like:

http://getvalue.asp?Action=GetValue&Name=Bobby&Gend
er=Male&Age=30&FavFood=A%26W'">Click To See Bobby Bio</a>

When using the value, you simply:

Response.write "<br>Name is " & Request("Name")
Response.write "<br>Gender is " & Request("Gender")
Response.write "<br>Age is " & Request("Age")
Response.write "<br>Favourite Food is " & Server.URLDecode(Request
("FavFood"))

This should work for you.

Kyle B. Willman
PricewaterhouseCoopers LLP
Office:  xxx.xxx.xxxx
Cell:   xxx.xxx.xxxx


                                                                                                                                    
                      "Cheng Kok Wai"                                                                                               
                      <kwcheng@i...       To: "ASP Web HowTo" <asp_web_howto@p...>                            
                      com.my>                  cc:                                                                               
                      07/16/2002 03:16         Subject:  [asp_web_howto] get the value of parameter passing                         
                      AM                                                                                                            
                                                                                                                                    
                      Please respond to                                                                                             
                      "ASP Web HowTo"                                                                                               
                                                                                                                                    
                                                                                                                                    




hi. how do i get the value of A&W from the code below? thanks.

<html>
<head>
<title>How To Get A&W Value</title>
</head>

<body>
<form method="post" name="frm">
<a
href="javascript:location.href
='getvalue.asp?Action=GetValue&Name=Bobby&Gend
er=Male&Age=30&FavFood=A&W'">Click To See Bobby Bio</a>
<%
If Request("Action") = "GetValue" Then
Response.write "<br>Name is " & Request("Name")
Response.write "<br>Gender is " & Request("Gender")
Response.write "<br>Age is " & Request("Age")
Response.write "<br>Favourite Food is " & Request("FavFood") 'how to get
the
value A&W here?
End If
%>
</form>
</body>
</html>



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20




_________________________________________________________________
         The information transmitted is intended only for the person or
         entity to which it is addressed and may contain confidential
         and/or privileged material.  Any review, retransmission,
         dissemination or other use of, or taking of any action in reliance
         upon, this information by persons or entities other than the
         intended recipient is prohibited.   If you received this in error,
         please contact the sender and delete the material from any
         computer.


  Return to Index