troubleshooting Question

ASP, multiple forms, request.form, appropriate syntax

Avatar of txkitty
txkitty asked on
Web Development
5 Comments1 Solution2822 ViewsLast Modified:
Hi Guys,

Here is some code that I've written:

<%
test1box=Request.Form("testytext")
testbutt1=Request.Form("hitme1")
test2box=Request.Form("testytext2")
testbutt2=Request.Form("hitme2")

response.write ("test1box="&test1box)
response.write ("<p>testbutt1="&testbutt1)
response.write ("<p>test2box="&test2box)
response.write ("<p>testbutt2="&testbutt2)

response.write ("<form action='testMainPage4.asp' method='post' name='test1'>")
response.write ("Testytext<input type='text' name='testytext' value='jimmy'>")
response.write ("<input type='submit' name='butt1' value='hitme1'>")
response.write ("</form>")

response.write ("<form action='testMainPage4.asp' method='post' name='test2'>")
response.write ("Testytext2<input type='text' name='testytext2' value='johnson'>")
response.write ("<input type='submit' name='butt2' value='hitme2'>")
response.write ("</form>")
%>

Two questions:

1) What syntax do I use to access information from multiple forms?  Right now I'm using Request.Form("[name of element]").  How do I specify that I want the element xyz from form #2 or element abc from form #1?

2) When I press the 'hitme1' submit button, a value is returned for 'testytext' (the textbox contained in the 1st form), but not for 'butt1' (the submit button contained in the 1st form).  Shouldn't it be returning the value of the submit button (e.g., 'hitme1")?  Is there something wrong with my syntax?

Thanks!

-Andrea
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros