Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

FrontPage Form writting to database

I have a Form written with FrontPage 2002 that displays the data to another form.  How do I make the second form submit the data to a database?
I use the <%response.write(request.form("address"))%>
to get the data to be viewable on the second form. Am I not bringing over the data to the seond form that why I can get it to post to databse?
1 Solution
I usually code this directly as an Active Server Page (ASP).  The page has to have an .asp file extension and you can look at your code to be sure that it's making a connection to the database and doing the update.

Here's a one version of code that makes a connection to an Access database (this would all be inside a <% %> except for my comments which begin with a -).

Set DataConn = Server.CreateObject("ADODB.Connection")
- this says you're going to make a connection

Set rs = Server.CreateObject("ADODB.Recordset")
-this says you're creating a recordset

DataConn.Open "DBQ=" & Server.Mappath("database.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
-this tells the server what kind of database

sql = "SELECT * FROM sometable"
-this is a basic SQL statement for getting the particular table you want to update

rs.Open sql, DataConn, 1, 3
-this opens the connection & matches the SQL statement with the connection and the recordset

-what you want to do with the data - i.e. add it

if request.form("data") <> "" then rs.Fields("data")    = request.form("data")

-if the form field "data" isn't blank then update the table field "data" with it's contents

-make the update

You should also have some code about closing the connection to the database.  Hope this helps.

The second form should be an .ASP page. You can use in the form fields:

Right click the second form in Normal View
Select Form Properties
Click Send to Database
Click Options
Select Database Connection to Use
Select Table to Hold Form Results

Save it as ASP page.

It will write to the database

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

jamesjsAuthor Commented:
When I go to the form properties and then options I don't see any of the form fields to be saved that I want to collect from the form.  And the add button is greyed out.

No need. OK,  I will put the full steps as an example of mine.

I have a database with one table that has the following fields: Name,Department,Supervisor.

I have a form called Submit.asp and another form called Verify.asp.  The user will fill in the Sumbit.asp and presses Submit.  Then it goes to the Verify.asp form where all the information entered in the first form are automatically displayed on the second for verification before submitting to the database.

Create the forms:
Open a new page
Inser Form
Line 1: Type Name:
Insert/Form/Textbox after the Name:
Double click the Textbox and name it as Name
Line 2: Type Department:
Insert/Form/Textboxk after the Department:
Doubl click the textbox and name it as Department
Line 3: Type Supervisor:
Insert/Form/Textbox after the Supervisor:
Double click the textbox and name it as Supervisor
Right click the form,  select properties
Select Send to Other
Click Options
In Action Put: Verify.asp
Save the form as Submit.asp

Open a new page
Insert form
Line 1: Same as above exactly in line 1 of Submit.asp then when you double click the Textbox name it as Name and in the value under it put: <%=request.form("Name")%>

Line 2: Same as above in line 2 of Submit.asp then when you double click the text box name it as Department,  then under it in the value put: <%=request.form("Department")%>

Line 3: Same as above in line 3 of Submit.asp then when you double click the text box name it as Supervisor, then under it in the value put: <%=request.form("Supervisor")%>

Right Click the form
Select Properties
Send to Database
Click Options
Select the Database Connection
Select the Data source (which table)
Then go to saved fields and verify each one.
Save the page as Verify.asp

Now when you open Submit.asp and fill the form,  then click submit,  the data will be send to Verify.asp,  if the user has any changes he/she can make them here then press submit to send the data to the database.

jamesjsAuthor Commented:
You helped me again.

Thank you so much..
your solution also helped me.   Question when the submit form has drop down menu selection of items, how do you populate the second form with that info..   Or can you only do this with "text box" fields

thank you
Hi bruce,

Just mention the name of the drop down menu like you do with the text field.



Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now