|
 |
asp_web_howto thread: text boxes
Message #1 by jay48202@y... on Wed, 9 Oct 2002 01:58:29
|
|
Hi,
I need to pass 'n' textbox values from one page to another page in asp.
page1 is working, I couldn't able to display those in page2. Here is the
code:-
page1.asp
---------
<html>
<head>
<title>New Page 1</title>
</head>
<body>
<form name="frm1" action="page2.asp" mehod="POST">
<%
Dim cntr
for cntr= 1 to 10
%>
<input type="text" size=10 name="lbl(<%response.write(cntr)%>)">
<%next%>
<input type="submit" value="submit">
</form>
</body>
</html>
page2.asp
----------
<html>
<head>
<title>New Page 2/title>
</head>
<body>
<form name="frm2" action="page2.asp" mehod="POST">
<%
Dim cntr,var(10)
for cntr= 0 to 9
var(cntr)=Trim(Request.Form("lbl(cntr)"))
response.write(var(cntr))
next
for cntr=0 to 9
Response.write(var(1))
next
%>
</form>
</body>
</html>
Thanks,
Jay
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 9 Oct 2002 13:15:29 +1000
|
|
a) On the first page you are doing a loop from 1 to 10. On the second page
you are doing a loop from 0 to 9, so you'll always be missing the last
label, and the first element in your array will be a zero length string.
Change the loop on the first page to be from 0 to 9
b) When you attempt to access the Request.Form() collection, you are doing
it incorrectly:
var(cntr)=Trim(Request.Form("lbl(cntr)"))
You need:
var(cntr) = Trim(Request.Form("lbl" & cntr))
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <jay48202@y...>
Subject: [asp_web_howto] text boxes
: Hi,
:
: I need to pass 'n' textbox values from one page to another page in asp.
: page1 is working, I couldn't able to display those in page2. Here is the
: code:-
:
: page1.asp
: ---------
: <html>
: <head>
: <title>New Page 1</title>
: </head>
: <body>
: <form name="frm1" action="page2.asp" mehod="POST">
: <%
: Dim cntr
: for cntr= 1 to 10
: %>
: <input type="text" size=10 name="lbl(<%response.write(cntr)%>)">
: <%next%>
: <input type="submit" value="submit">
:
: </form>
: </body>
: </html>
:
: page2.asp
: ----------
: <html>
: <head>
: <title>New Page 2/title>
: </head>
: <body>
: <form name="frm2" action="page2.asp" mehod="POST">
: <%
: Dim cntr,var(10)
: for cntr= 0 to 9
: var(cntr)=Trim(Request.Form("lbl(cntr)"))
: response.write(var(cntr))
: next
:
: for cntr=0 to 9
: Response.write(var(1))
: next
: %>
: </form>
: </body>
:
: </html>
:
:
: Thanks,
: Jay
:
: ---
:
: 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
|
|
 |