473,396 Members | 2,009 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,396 software developers and data experts.

Save input from HTML to Access Database using JavaScript

Hi Buddzy

Can you plz help to connect to Access DataBase input from HTML form using insert statement. I am still new on programming with html here is my code .

[HTML]<html>
<head>
<title>Entitled Document</title>
<script language="JavaScript" >

function getSubmit()
{
var name1 = eval(document.form1.names.value)
var cn = new ActiveXObject("ADODB.Connection");
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = G:\clientDB.mdb";
cn.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");



// I need help for the following line ("' + name1 +' " )
var SQL = "insert into Customers values( "' + name1 +' " )";



rs.Open(SQL, cn);
//alert(rs(0));
rs.Close();
cn.Close();

}

</script>
</head>
<body>
<FORM name="form1" action="mailto:email@domaine.com" method="post">
<input type="text" name="names" />
<input type="button" value="submit" onclick="getSubmit()"/>
</form>
</body>
</html>[/HTML]

regards,
Mkhize
Oct 11 '07 #1
3 11567
Hi Buddzy
[IMG]C:\Documents and Settings\Developer\My Documents\My Pictures\IMG_1078.JPG[/IMG] plz help to connect to Access DataBase input from HTML form using insert statement. I am still new on programming with html here is my code .

[HTML]<html>
<head>
<title>Entitled Document</title>
<script language="JavaScript" >

function getSubmit()
{
var name1 = eval(document.form1.names.value)
var cn = new ActiveXObject("ADODB.Connection");
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = G:\clientDB.mdb";
cn.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");



// I need help for the following line ("' + name1 +' " )
var SQL = "insert into Customers values( "' + name1 +' " )";



rs.Open(SQL, cn);
//alert(rs(0));
rs.Close();
cn.Close();

}

</script>
</head>
<body>
<FORM name="form1" action="mailto:email@domaine.com" method="post">
<input type="text" name="names" />
<input type="button" value="submit" onclick="getSubmit()"/>
</form>
</body>
</html>[/HTML]

regards,
Mkhize
Oct 11 '07 #2
acoder
16,027 Expert Mod 8TB
On line 17, you have the single and double quotes mixed up.
Oct 15 '07 #3
acoder
16,027 Expert Mod 8TB
Threads merged. Please do not double post.
Oct 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
1
by: LC's No-Spam Newsreading account | last post by:
I have the following arrangement working under Netscape 3 / Unix, IE6 / Win and Konqueror / Linux, but NOT under Netscape 7 Unix or Mozilla Linux (silently fails) nor under Netscape 4 Unix (fails...
4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
1
by: empiresolutions | last post by:
Hello fellow code junkies, I am using the "Ajax dynamic list" http://dhtmlgoodies.com/index.html?whichScript=ajax-dynamic-list and i think its the best out there. I have found a compatibility...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
13
underscore
by: underscore | last post by:
gud day to all TSD. if i run the code below which is HTML combine with php. my problem encoutered in php code. it will automatically save all blank textbox i declare in php to my database using...
1
by: kiranbabu | last post by:
<html> <head> <style type="text/css"> h2{color:#A02820} </style> </head> <script language=javascript>
1
by: irfanshariffa | last post by:
<html> <head> <script type="text/javascript" language="javascript"> function validate() { if (document.form.fname.value=="") { alert("Enter your Name"); document.form.fname.focus();
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.