By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,286 Members | 2,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,286 IT Pros & Developers. It's quick & easy.

HTML Form

P: n/a
Can someone help me with the code to take the data in four fields on an HTML
form and add it to a table in a database on an intranet.

Thanks to all who help!

Kathy
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Kathy,

You need file based access to the database from your Intranet server. From
there you will create two
pages, one that holds the form and fields, the second that holds the code to
connect to your mdb. Then execute an "INSERT" sql statement to get the data
into a table. If you are not familiar with any of that, you should look
into the ADO connection object. It would accomplish all of this easily if
you can use ASP or vbscript on the second page. It is important to keep in
mind that the code written on the second page runs only on the server and is
never shown to the user by means of using special tags that specify to
"runat" the server.

If you are running IIS on your intranet server then this is the vbscript for
Microsoft ASP pages...

First page: (firstpage.asp)
<html>
<body>
<p>Please fill in this data....</p>
<form name="myform" method="post" action="secondpage.asp">
<input name="fldFirstName" Value="">
<input name="fldLastName" Value="">
</form>
</body>
</html>

Second page: (secondpage.asp)
<%
dim cn
Set cnn1 = Server.CreateObject("ADODB.Connection")
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/somesubfolder/somedb.mdb") & ";Persist Security Info=False"
cnn1.execute "INSERT Into myTable FirstName, LastName VALUES(" &
request.form("fldFirstName") & ", " & request.form("fldLastName") & ")"
cnn.close
set cnn = nothing
response.write "<html><body><p>Thanks for adding that
data...</p></body></html>"
%>

You can replace the Server.MapPath() with the actual path to the mdb. The
tools are all there, it's just
a matter of learning! Let me know if you need any more help with that.

Good Luck!!

Jerry Boone
je***@antech.biz.nospam (remove .nospam before sending)
President - Analytical Technologies, Inc.
ASP, ASP.NET, SQL Server Hosting
http://www.antech.biz

"Kathy" <kd******@earthlink.net> wrote in message
news:a_*****************@newsread2.news.atl.earthl ink.net...
Can someone help me with the code to take the data in four fields on an HTML form and add it to a table in a database on an intranet.

Thanks to all who help!

Kathy

Nov 12 '05 #2

P: n/a
Jerry,

Thank you very much for the response!!

I normally see a Submit button on a form like this but I don't see one here.
What causes the code on the second page to execute after the user fills in the
fields on the first page?

Can this be done with DAO and without ASP?

Thanks!

Kathy


"Jerry Boone" <je***@antech.biz.killspam> wrote in message
news:MO********************@newssvr11.news.prodigy .com...
Kathy,

You need file based access to the database from your Intranet server. From
there you will create two
pages, one that holds the form and fields, the second that holds the code to
connect to your mdb. Then execute an "INSERT" sql statement to get the data
into a table. If you are not familiar with any of that, you should look
into the ADO connection object. It would accomplish all of this easily if
you can use ASP or vbscript on the second page. It is important to keep in
mind that the code written on the second page runs only on the server and is
never shown to the user by means of using special tags that specify to
"runat" the server.

If you are running IIS on your intranet server then this is the vbscript for
Microsoft ASP pages...

First page: (firstpage.asp)
<html>
<body>
<p>Please fill in this data....</p>
<form name="myform" method="post" action="secondpage.asp">
<input name="fldFirstName" Value="">
<input name="fldLastName" Value="">
</form>
</body>
</html>

Second page: (secondpage.asp)
<%
dim cn
Set cnn1 = Server.CreateObject("ADODB.Connection")
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/somesubfolder/somedb.mdb") & ";Persist Security Info=False"
cnn1.execute "INSERT Into myTable FirstName, LastName VALUES(" &
request.form("fldFirstName") & ", " & request.form("fldLastName") & ")"
cnn.close
set cnn = nothing
response.write "<html><body><p>Thanks for adding that
data...</p></body></html>"
%>

You can replace the Server.MapPath() with the actual path to the mdb. The
tools are all there, it's just
a matter of learning! Let me know if you need any more help with that.

Good Luck!!

Jerry Boone
je***@antech.biz.nospam (remove .nospam before sending)
President - Analytical Technologies, Inc.
ASP, ASP.NET, SQL Server Hosting
http://www.antech.biz

"Kathy" <kd******@earthlink.net> wrote in message
news:a_*****************@newsread2.news.atl.earthl ink.net...
Can someone help me with the code to take the data in four fields on an

HTML
form and add it to a table in a database on an intranet.

Thanks to all who help!

Kathy


Nov 12 '05 #3

P: n/a
Sure, you can drop a submit button on and that will be fine. Anything that
submits the <form> will post the data to the server. The Action element in
the <form> tags tells the page to submit TO secondpage.asp. When
secondpage.asp is being loaded, it reads in the form elements and their
values, then pokes them into the database by using
request.field("somefieldname").

I only work with ASP so I don't know about using something else. ASP is
enabled on every version of Windows... Win98 (by use of Personal Web
Server), NT4 Workstation (by use of Personal Web Server from resource kit),
NT4 Server (IIS3,4,5), Win2K(IIS 5,6), and XP Pro (IIS6). Once you do that,
you can access your intranet by using http://myservername/sompage.asp (or
html). It's really easy.

You should be able to use DAO components for data transfer, but your on your
own there. ADO is my first choice because it's heavily documented, has
multiple ways to do things, and by nature is designed for this task. It
also contains way more features for other operations, including xml and
offline file based recordsets that are portable and can be re-instantiated
for use. Too much to list on that stuff, books are written just to cover
these components....

:)

--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz
"Kathy" <kd******@earthlink.net> wrote in message
news:_W*****************@newsread1.news.atl.earthl ink.net...
Jerry,

Thank you very much for the response!!

I normally see a Submit button on a form like this but I don't see one here. What causes the code on the second page to execute after the user fills in the fields on the first page?

Can this be done with DAO and without ASP?

Thanks!

Kathy


"Jerry Boone" <je***@antech.biz.killspam> wrote in message
news:MO********************@newssvr11.news.prodigy .com...
Kathy,

You need file based access to the database from your Intranet server. From there you will create two
pages, one that holds the form and fields, the second that holds the code to connect to your mdb. Then execute an "INSERT" sql statement to get the data into a table. If you are not familiar with any of that, you should look
into the ADO connection object. It would accomplish all of this easily if you can use ASP or vbscript on the second page. It is important to keep in mind that the code written on the second page runs only on the server and is never shown to the user by means of using special tags that specify to
"runat" the server.

If you are running IIS on your intranet server then this is the vbscript for Microsoft ASP pages...

First page: (firstpage.asp)
<html>
<body>
<p>Please fill in this data....</p>
<form name="myform" method="post" action="secondpage.asp">
<input name="fldFirstName" Value="">
<input name="fldLastName" Value="">
</form>
</body>
</html>

Second page: (secondpage.asp)
<%
dim cn
Set cnn1 = Server.CreateObject("ADODB.Connection")
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/somesubfolder/somedb.mdb") & ";Persist Security Info=False" cnn1.execute "INSERT Into myTable FirstName, LastName VALUES(" &
request.form("fldFirstName") & ", " & request.form("fldLastName") & ")"
cnn.close
set cnn = nothing
response.write "<html><body><p>Thanks for adding that
data...</p></body></html>"
%>

You can replace the Server.MapPath() with the actual path to the mdb. The tools are all there, it's just
a matter of learning! Let me know if you need any more help with that.

Good Luck!!

Jerry Boone
je***@antech.biz.nospam (remove .nospam before sending)
President - Analytical Technologies, Inc.
ASP, ASP.NET, SQL Server Hosting
http://www.antech.biz

"Kathy" <kd******@earthlink.net> wrote in message
news:a_*****************@newsread2.news.atl.earthl ink.net...
Can someone help me with the code to take the data in four fields on
an HTML
form and add it to a table in a database on an intranet.

Thanks to all who help!

Kathy



Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.