473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HTML Form

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
3 3698
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Hansan | last post by:
Hi all, I hope you have time to help me out a little. My problem is that I want to combine some python code I have made with some html templates, I found a tutorial at dev shed:...
5
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the...
16
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
4
by: Sathyaish | last post by:
I am no JavaScript progammer, and unfortunately am having to babysit an old code base that has a lot of JavaScript in it. I have two questions: (1) Can two HTML controls have the same name? It...
7
by: thersitz | last post by:
I can't seem to get my html form to submit properly from within a web form. Here's my form tag syntax and some delivery hidden fields. <form id="myForm"...
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
1
by: Arpit Nagar | last post by:
Hi... I am creating a dummy project for collage. Here I had choosen my project as Jewelleryshoping. Now the scenerio is like that thier are jewellry item which I had display in table format with...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
9
by: dhtml | last post by:
I have written an article "Unsafe Names for HTML Form Controls". <URL: http://jibbering.com/faq/names/ > I would appreciate any reviews, technical or otherwise. Garrett --...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.