Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 96,866 times

Contents

Related Categories

Creating a Members Area in ASP - Registration Form

Registration Form

Now the database has been created, we can create our registration page where new members can register online. First, let's get the basic HTML code together.

<html>
<head>
<title>My Website's Registration Page</title>
</head>
<body>
<h1>Member Registration</h1>
<p>Please fill out the following form to register as a member, and gain access to our members area.</p>
<form action="register.asp" method="POST">
<input type="hidden" name="action" value="register">
<table border="0">
<tr>
  <td><b>Username</b></td>
  <td><input type="text" maxlength=20 name="username"></td>
</tr>
<tr>
  <td><b>Password</b></td>
  <td><input type="password" maxlength=20 name="password"></td>
</tr>
<tr>
  <td><b>Password Confirm</b></td>
  <td><input type="password" maxlength=20 name="password_confirm"></td>
</tr>
<tr>
  <td> </td>
  <td><input type="submit" value="Complete Registration"></td>
</tr>
</table>
</form>
</body>
</html>

As you can see, this is currently just plain html, and currently look something like this:

Now it's time to add some ASP code to make our form actually do something! First, we'll check to see if the form has been submitted. We can do this by checking the value of the action field, which is actually a hidden field in the form:

'see if the form has been submitted
If Request.Form("action")="register" Then
   'the form has been submitted

Now we know that the form has been submitted, we need to validate it. There are a number of things we need to check:

  • A username has been entered
  • A password has been entered
  • The passwords are the same
  • That the username has not already been taken

The last item on the list cannot be done until we connect to the database, so we leave that validation until last.

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments

  • Re: [1744] Creating a Members Area in ASP

    Posted by iniojdweb08 on 02 Sep 2008

    I need this to work with a single username & password, that I set, with no registration necessary. Can this be done?

  • Re: [1744] Creating a Members Area in ASP

    Posted by root on 13 Aug 2008

    Hello, thanks for the code it really works!

    Actually I´m using SQL Server 2000 and it is possible to register the users with the same user name, and there is not any me...

  • Re: [1744] Creating a Members Area in ASP

    Posted by shawne on 11 May 2007

    I want to with u a happy day .. And thank's once again for giving us the source code.. but unfortunately i just use your code for my following project but then i got some error said ---The include ...

  • Re: [1744] Creating a Members Area in ASP

    Posted by rob1210 on 15 Feb 2007

    Hi, being a bit of a newbee to ASP but am quite up to speed with SQL and some web development. I am struggling a little with getting to grips with what I need to do with some of the code. In the tutor...

  • Re: registration form

    Posted by nathancan on 20 Nov 2006

    If I look at the page in Dreamweaver or similar I also see the code.  However, when it is uploaded to my web server it appears without the code.
    Are you sure your web server can run asp?