Trying to create an HTML page called Project.html that will ask the user for basic information (name, e-mail address, and comments), and when the SUBMIT buttom is hit, add the users to an Access 2007 Database. Ideally, the information would only be able to be added once, but I need the adding sequence to work first. Any and all comments or questions would be appreciated.
Anthony
Beginning Programmer
Anthony
Beginning Programmer
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Project input Form</title>
<style type="text/css">
.style1
{
width: 70%;
}
.style2
{
text-align: right;
width: 261px;
}
#Text1
{
width: 191px;
}
#Text2
{
width: 189px;
}
#Text3
{
width: 190px;
}
#Button1
{}
</style>
<SCRIPT LANGUAGE="JavaScript">
function addrecord (form) {
var cn = new ActiveXObject("ADODB.Connection");
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\aknab\My Documents\testingapp\users.accdb;Persist Security Info=False";
cn.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
var SQL = "select count(*) from Customers";
rs.Open(SQL, cn);
alert(rs(0));
rs.AddNew 'Prepare the database to add a new record and add
rs.Fields("name") = Request.Form("cname");
rs.Fields("email") = Request.Form("cemail");
rs.Fields("comments") = Request.Form("ccomments");
rs.Update; 'Save the update
rs.Close();
cn.Close();
}
</script>
</head>
<body>
<p style="text-align: center">
Vetsulin Test page.<br />
</p>
<table class="style1">
<tr>
<td class="style2">
Name </td>
<td>
<input id="Text1" type="text" name="cname" /></td>
</tr>
<tr>
<td class="style2">
e-mail
</td>
<td>
<input id="Text2" type="text" name="cemail" /></td>
</tr>
<tr>
<td class="style2">
Comments
</td>
<td>
<input id="Text3" type="text" name="ccomments"/></td>
</tr>
</table>
<p style="text-align: center">
<input id="Submit1" type="submit" value="submit" onClick="addrecord(this.form)" />
<input id="Reset1" type="reset" value="reset" /></p>
</body>
</html>
Comment