Beginning Active Server Pages

Forms 2

Try viewing this in a browser, filling out its information, and clicking "Sign Up". As you can see, at the moment the page doesn't do very much. You are just returned to the same page, with the fields you filled out cleared again!

Our ASP page so far...

What we need to do now is add some code to process the inputted data. ASP provides the Request.Form property for retrieving posted form information, and uses the following syntax:


First of all, we need a way to detect if the information has been posted or not - otherwise, we won't know whether to display the form, or process it. In the original page, we included a hidden field called posted. Although the user couldn't change it, it is a useful check to see if the form has been posted. If it has, the field will have been sent along with everything else, and its value will be 1. If the Sign Up button has not been clicked (and therefore the data not posted), its value will be nothing. So, to check if the form is posted or not, we can use

If Request.Form("posted") = 1 Then 'form posted
    Response.Write "<p>Thankyou for signing up</p>"
Else 'display the form %>
 <form action="forminput.asp" method="POST">
  Your Name <input type="text" maxlength=20 name="Name"><br>
  Your Email <input type="text" maxlength=100 name="Email"><br>
  <input type="hidden" name="Posted" value="1">
  <input type="submit" value="Sign Up">
<% End If %>

At the moment, however, we can't really do anything with the data posted, until we know how to add it to a database. This is covered next.

You might also like...


About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Memory is like an orgasm. It's a lot better if you don't have to fake it.” - Seymour Cray