Showing posts with label Request.Form. Show all posts
Showing posts with label Request.Form. Show all posts

Parsing form values using classic asp

0 comments
To start the examples, below is a simple method for parsing form variables in asp.

Firstly the simple form:

<html>
<body>
<form name="form1" method="post" action="form.asp">
Full Name: <input type="text" name="txt_full_name">
Location: <input type="text" name="txt_location">
<input type="submit" value="Submit Form">
</form>
</body>
</html>


Secondly is the asp for receiving the form variables:

<%
'Form variables for form1
form_full_name=Request.Form("txt_full_name")
form_location=Request.Form("txt_location")
%>

Lastly to display the retrieved form values:


<%
'Display form values
Response.write(form_full_name)
Response.write(form_location)
%>

You can also write the same form value with out defining a name as shown below:

<%
Response.write(Request.Form("txt_full_name"))
Response.write(Request.Form("txt_location"))
%>

Code all together: form.asp

<html>
<body>
<form name="form1" method="post" action="form.asp">
Full Name: <input type="text" name="txt_full_name">
Location: <input type="text" name="txt_location">
<input type="submit" value="Submit Form">
</form>
</body>
</html>

<%
'Form variables for form1
form_full_name=Request.Form("txt_full_name")
form_location=Request.Form("txt_location")
%>

<%
'Display form values
Response.write(form_full_name)
Response.write(form_location)
%>
 
Copyright 2009 <?> Why ASP </?>
BloggerTheme by Infinityskins