Form Verification Example for FrontPage



Use this example if you want users to verify their form information prior to final submission to your database.
This example requires three pages; verify1.asp, verify2.asp and verify3.asp.

Verify1.asp
This page does not actually have to have the .asp extension because the only thing it contains in this example is the initial input form. The page you are currently reading is verify1.asp and this is the form:

We are using the shippers table in the Northwind sample database (this form will not actually work).
Company Name
Phone Number

The first input box should be named CompanyName and the second is Phone

Right click on top of one of the form fields (in your example) and select Form Properties. In Form Properties, select Send to Other and then click options. In the Action field, type verify2.asp. Click OK twice and save verify1.asp.

Verify2.asp
This page shows the user the information the inserted so that they can verify it before we do the final submit to the database. We will need to do some hand coding on this page. To get started, insert a blank form field with a Submit and Reset button (Insert > Form > Form).

Place your cursor inside the form area and to the left of the Submit button. Press Enter twice to move the Submit button down. Place the cursor on the top line inside the form. Click Insert > Advanced > HTML. Insert the following code:

<% CompanyName = Request.Form("CompanyName") Phone = Request.Form("Phone") Response.Write CompanyName

Response.Write Phone

%>

Press OK. Now, right click inside the form and select Form Properties. Select the Send to Other option and then click the Options button. In the Action box, type verify3.asp and click OK. Now click the Advanced button. We are going to add two hidden fields:

Hidden field 1: Name = CompanyName Value = <% = CompanyName %>
Hidden field 2: Name = Phone Value = <% = Phone %>

Click OK twice. Add some text to tell your user to verify the information and click submit when done. Save verify2.asp.

Verify3.asp
This page contains the SQL code to write the users information to the database. Get started by inserting a database results region: Insert > Database > Results.

On step one, choose your database connection. Click Next. On step two, select the custom query option and click Edit. Delete any existing text and insert the following:
INSERT INTO Shippers (CompanyName, Phone) VALUES (‘::CompanyName::’, ‘::Phone::’)

In step three, choose more options. In the “message to display if no records are returned” box, change the default to something like “Record entered”. Proceed to step four. Select List – One item per field from the drop down and uncheck the two boxes. Go to step five, unselect the add search form check box and click finish.

That’s it!

Leave a Reply

Your email address will not be published. Required fields are marked *