You are on page 1of 3

.

access :

127.0.0.1 : Inetpub\wwwroot
form.html
<html><head>
<script language=javascript>
function digits(numstr)
{
for(i=0; i<numstr.length; i++)
{
if(numstr.charAt(i)>'9' || numstr.charAt(i)<'0')

return(false);
.members.mdb :
}
tMem :
return(true);
}
function checkForm()
{
if (document.frm.fName.value=="")
{
alert (";)"
document.frm.fName.focus();
document.frm.fName.select();
return(false);
}
if (document.frm.lName.value=="")
{
alert (";)"
document.frm.lName.focus();
document.frm.lName.select();
return(false);
}
if(document.frm.birth.value=="")
{
alert(";)"
document.frm.birth.focus();
document.frm.birth.select();
return(false);
}
if (document.frm.birth.value.length!=4)
{
alert(" 4 ;)"
document.frm.birth.focus();
document.frm.birth.select();
return(false);
}
if (document.frm.email.value == "")
{
alert("E-Mail ;)"

document.frm.email.focus();
document.frm.email.select();
return (false);
}
if (document.frm.email.value.indexOf("@") < 2)
{
alert("@ ;)"

document.frm.email.focus();
document.frm.email.select();
return (false);
}
alert(";)"
return(true);

ins.asp

}
</script>
</head>
<body bgColor=lightgreen>
<form name=frm onsubmit="return checkForm()" action=ins.asp method=post>
<table align=right border=0>
<tr>
<td align=middle><font size=6><b>< /b></font><br><br>
</td>
</tr><br><br>
< tr >
<td align=right><input style="text-align: right" tabIndex=1 align=right
name=fName> </td>
<td align=right><font size=3><b>< /b></font> </td>
</ tr >
< tr >
<td align=right>< input style=" text-align: right" tabIndex=2 align=right
size=25 name=lName> </td>
<td align=right><font size=3><b>< /b></ font> </td>
</tr>
<tr>
<tr>
<td align=right>< input tabIndex=3 align=right size=9 name=birth> </td>
<td align=right>< font size=3><B>< /B></ font > </td>
</tr>
<tr>
<td align=right>< input tabIndex=4 align=right size=50 name=email> </td>
<td align=right>< font size=3><b>E-Mail</b></ font > </td>
</tr>
<tr>
<td align=middle>< input type=submit align=right value=" " name=submit>
</td>
<td align=left>< input type=reset align=right value=" " name=reset>
</td>
</tr>
</table>
</form>
</body>
</html>

form2.html
.action=myinsert2.asp : form.html
<form name=frm onsubmit="return checkForm()" action=myinsert2.asp method=post>

myinsert2.asp

ins.asp
.Connection oConn
<%

%>

Set oConn = Server.CreateObject("ADODB.Connection")


.Connection open driver
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=C:\Inetpub\wwwroot\MySite\data_mem\members.mdb;"
.Recordset oRS
Set oRS = Server.CreateObject("ADODB.Recordset")
SQL
mySQL = "SELECT * FROM tMem WHERE 1=0"
. recordset open
oRS.Open mySQL, oConn, 3, 3
.
oRS.AddNew
oRS.Fields("first").Value = Request.Form("fName")

oRS.Fields("family").Value = Request.Form("lName")

oRS.Fields("birth_year").Value = CInt(Request.Form("birth"))

oRS.Fields("mail").Value = Request.Form("email")
oRS.Update
oRS.Close
Recordset
Set oRS = Nothing
oConn.Close
Set oConn = Nothing Connection

<%=Request.Form("fName")%>

<br/>
<a href="Form.html"> < /a>

myinsert2.asp
<%
f
l
b
m

= Request.Form("fName")
= Request.Form("lName")
= Request.Form("birth")
= Request.Form("email")

. SQL . sq
sq="insert into tMem(first,family,birth_year,mail) values ('"&f&"','"&l&"','"&b&"','"&m&"')"
.Connection con
set con=Server.CreateObject("ADODB.Connection")
.Connection open driver
con.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=C:\Inetpub\wwwroot\MySite\data_mem\members.mdb;"

%>

.sq - SQL - Execute


.con
con.Execute sq
con.close
set con=nothing
Connection

access


<%=f%>

<br/>
<a href="Form2.html"> < /a>

You might also like