Help..how to make confirmation code
Hi....I need help pleesseeaaa....Thank in advance for your help.
I have been working with my code and i just cant figure out how to make my confirmation form works.
With confirmation page.
It will also will do some checking first if the user add the same
EmployeeID it will show 'data already exists' and it will return to form 1.asp if the data never been add before it will do
another checking everytime User want to save it will show that 'Data have been saved', If the user change their mind
not to save the data it will show 'Data have been cancel '.
this my code:
form1.asp
<BODY>
<FORM ACTION="ResultADD.asp" METHOD=post Name=frmAdd>
<TABLE style="WIDTH: 402px; HEIGHT: 172px" cellSpacing=1 cellPadding=1 width=402
border=1>
<TR><TD>EmployeeID</TD>
<TD><INPUT type="text" name="EmpID" value="<%=session("ID")%>" ></TD></TR>
<TR><TD><P>EmployeeName</P></TD>
<TD><INPUT type="text" name="EmpName" value="<%=session("SName")%>" ></TD></TR>
<TR><TD>EmployeeAddress</TD>
<TD><INPUT type="text" name="EmpAddress" value="<%=session("Address")%>" ></TD></TR>
<TR><TD>EmployeePhoneHome</TD>
<TD><INPUT type="text" name="EmpPhone" value="<%=Session("PhoneHome")%>" ></TD></TR>
<TR><TD>EmployeePostalCode</TD>
<TD><SELECT type="dropdown" name="EmpPostal" value="<%=Session("PostalCode")%>" style="WIDTH: 154px" > <OPTION selected>
<OPTION>1234</OPTION>
<OPTION>2345</OPTION></SELECT></TD></TR>
<TR><TD>EmployeeSalary</TD>
<TD><INPUT type="text" name="EmpSalary" value="<%=Session("Salary")%>" ></TD></TR>
</TABLE></P>
<P><INPUT type=submit value=Submit name=submit1>
<INPUT id=reset1 type=reset value=Reset name=reset1></P><BODY>
Form2.asp
<%
Dim strConnect, strsql, strTo
Session("ID") = Request.Form("EmpID")
Session("SName") = Request.Form("EmpName")
Session("Address") = Request.Form("EmpAddress")
Session("PhoneHome") = Request.Form("EmpPhone")
Session("PostalCode") = Request.Form("EmpPostal")
Session("Salary") = Request.Form("EmpSalary")
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\TblEmploy.mdb"
Set Conn= Server.CreateObject ("ADODB.Connection")
Conn.Open strConnect
strsql = "INSERT INTO Data(EmployeeID,EmployeeName,EmployeeAddress, EmployeePhoneHome, EmployeePostalCode, EmployeeSalary) " & _
"VALUES('"& session("ID")&"','"& session("SName")&"','"& session("Address")&"', " & _
"'"& session("PhoneHome")&"','"& session("PostalCode")&"','"& session("Salary")&"')"
Conn.Execute strSQL
Conn.Close
set Conn = nothing
Session("EmployeeID") = ""
Session("EmployeeName") = ""
Session("EmployeeAddress") = ""
Session("EmployeePhoneHome") = ""
Session("EmployeePostalCode") = ""
Session("EmployeeSalary") = ""
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM ACTION=ConfirmADD.asp METHOD=post Name=frmConfirm>
<P>
<%
Response.Write "<br>" & Session("ID") & "</br>"
Response.Write "<br>" & Session("SName") & "</br>"
Response.Write "<br>" & Session("Address") & "</br>"
Response.Write "<br>" & Session("PhoneHome") & "</br>"
Response.Write "<br>" & Session("PostalCode") & "</br>"
Response.Write "<br>" & Session("Salary") & "</br>"
%>
<P> <INPUT id=submit1 style="WIDTH: 63px; HEIGHT: 35px" type=submit size=21 value=Save name=submit1>
<INPUT style="WIDTH: 63px; HEIGHT: 35px" type=submit size=21 value=Cancel ></P>
Form3.asp
<%
Dim strTo
strTo=Request.QueryString("Status")
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<CENTER><H1> CONFIRMATION PAGE </H1></CENTER>
<% If strTo <> "'Exists'" then %>
<% Response.Write "<CENTER>Data alredy exists</CENTER>"
Response.Redirect ("Form1.asp") %>
<% else %>
<% Response.Write "<CENTER>data was saved to the database</CENTER>"%>
<% end if %><CENTER> </CENTER>
was saved to the database.
<INPUT id=submit1 style="WIDTH: 127px; HEIGHT: 46px" type=button size=42 value=Back
any help and suggestion really appreciate
thanks
|