Link to home
Start Free TrialLog in
Avatar of jamesjs
jamesjs

asked on

Need to confirm form data before submitting data to database

I created a form that when the users hit's the submit button the users get a confirmation page and data goes into a database. THis works fine except if they make a mistake.

I would like to make a confirmation page that shows the data the users has inputed into the form but does not go into to the database.  Then the users could check the data and if there was a mistake they could push the back button to fix any errors.  If all data was fine they could push the submit button which would enter the data into the database and give them a confirmation page to tell them the data was submited successfully.
ASKER CERTIFIED SOLUTION
Avatar of hhammash
hhammash

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KenAdney
KenAdney

Using this method you can also set fields to be mandatory and check to be sure the format of the info is correct.  Here's a small example using ASP:

error_message = ""

If contractor = "" Then
     error_message = ("<p>You have to include the primary contractor.</p>")
End If

If Len(dob)>1 and IsDate(dob) = False Then
     error_message = ("<p>Date of birth is invalid</p>")
End If

If Len(ssn)>1 and Len(ssn)<>9 Then
     error_message = ("<p>The Social Security number must be 9 digits</p>")
End If

If error_message <> "" Then
     Response.write("<html><head><title>Error messages</title></head><body>")
     Response.write("There was an error in your form. Press your browsers BACK button...")
     Response.write(error_message)
     Response.write("</body></html>")
     response.end
Else ....

I guess you figured out that this is pretty much impossible just using FrontPage.... :-)
Avatar of jamesjs

ASKER

I have taken your suggestion hhammash and now I have the second page filled out but I cannot get the second page to post to the database and get a confirmation page.  When I hit submit I just see thae second page again with no information.  I'm thinking I need to use the code <%
response.write(request.form("first_name"))%>
to get confirmation info on the page.  That would be fine but why is not talking to my database?  

One piece of info that I left out was that I built this with FRONTPAGE 2002.

Thank you.
Avatar of jamesjs

ASKER

This gave me the information I need to get the data to the second form.  
Hi Jamesis,

You are welcome,  I am glad it worked.

Note:
------
In FrontPage,  you can go to Insert/Web Component/Advanced Controls/Confirmation Field.  This will enable you create a confirmation page.

Of course the Request.form will enable you do that too.

Best regards
hhammash
Hi Jamesjs,

I tried it <%=Request.form("FieldName')%>

It will work for sure. The first form should be ASP and the second should be ASP too.

Regards
hhammash