<% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.addHeader "cache-control", "no-cache" Response.addHeader "cache-control", "no-store" Response.CacheControl = "no-cache" %> <% ewCurSec = 0 ' Initialise ' User levels Const ewAllowAdd = 1 Const ewAllowDelete = 2 Const ewAllowEdit = 4 Const ewAllowView = 8 Const ewAllowList = 8 Const ewAllowReport = 8 Const ewAllowSearch = 8 Const ewAllowAdmin = 16 %> <% ' Initialize common variables x_ID = Null: ox_ID = Null x_Names = Null: ox_Names = Null x_Sex = Null: ox_Sex = Null x_Address1 = Null: ox_Address1 = Null x_State = Null: ox_State = Null x_Country = Null: ox_Country = Null x_Phone = Null: ox_Phone = Null x_Email = Null: ox_Email = Null x_Comment = Null: ox_Comment = Null %> <% Response.Buffer = True ' Load key from QueryString bCopy = True x_ID = Request.QueryString("ID") If x_ID = "" Or IsNull(x_ID) Then bCopy = False End If ' Get action sAction = Request.Form("a_add") If (sAction = "" Or IsNull(sAction)) Then If bCopy Then sAction = "C" ' Copy record Else sAction = "I" ' Display blank record End If Else ' Get fields from form x_ID = Request.Form("x_ID") x_Names = Request.Form("x_Names") x_Sex = Request.Form("x_Sex") x_Address1 = Request.Form("x_Address1") x_State = Request.Form("x_State") x_Country = Request.Form("x_Country") x_Phone = Request.Form("x_Phone") x_Email = Request.Form("x_Email") x_Comment = Request.Form("x_Comment") End If ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Select Case sAction Case "C": ' Get a record to display If Not LoadData() Then ' Load Record based on key Session("ewmsg") = "No records found" conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "contactMSG.asp" End If Case "A": ' Add If AddData() Then ' Add New Record Session("ewmsg") = "Add New Record Successful" conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "contactMSG.asp" Else End If End Select %> Contact_us.asp n
Welcome to www.elifeonline.net Editorial Comments. About Livingprojects Media Network Ltd. Speak to us.
Send your Prayer Requests. Services by Livingprojects Media Network Ltd. Christian books
Past Editions of www.elifeonline.net. News about the Church of God. Time to laugh.
Livingprojects Media Network
112, Aladelola Street,
by Apaola Street,
Ikosi-Ketu, Lagos, Nigeria.
Telephone Numbers
+234-803-719-5091
+234-802-424-7404,
+234-1-794-1627
Email Contact:: info@elifeonline.net ......................... editor@elifeonline.net
Contact Information

Field marked * are compulsory.

Names*
Sex*
Address*
State*
Country*
Phone
Email* yourname@domain.com
Comment/Questions
<% conn.Close ' Close Connection Set conn = Nothing %> <% '------------------------------------------------------------------------------- ' Function LoadData ' - Load Data based on Key Value ' - Variables setup: field variables Function LoadData() Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy sSql = "SELECT * FROM [contact]" sWhere = "" sGroupBy = "" sHaving = "" sOrderBy = "" If sWhere <> "" Then sWhere = sWhere & " AND " sWhere = sWhere & "([ID] = " & AdjustSql(x_ID) & ")" sSql = sSql & " WHERE " & sWhere If sGroupBy <> "" Then sSql = sSql & " GROUP BY " & sGroupBy End If If sHaving <> "" Then sSql = sSql & " HAVING " & sHaving End If If sOrderBy <> "" Then sSql = sSql & " ORDER BY " & sOrderBy End If Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sSql, conn If rs.Eof Then LoadData = False Else LoadData = True rs.MoveFirst ' Get the field contents x_ID = rs("ID") x_Names = rs("Names") x_Sex = rs("Sex") x_Address1 = rs("Address1") x_State = rs("State") x_Country = rs("Country") x_Phone = rs("Phone") x_Email = rs("Email") x_Comment = rs("Comment") End If rs.Close Set rs = Nothing End Function %> <% '------------------------------------------------------------------------------- ' Function AddData ' - Add Data ' - Variables used: field variables Function AddData() Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy Dim bCheckKey, sSqlChk, sWhereChk sSql = "SELECT * FROM [contact]" sWhere = "" sGroupBy = "" sHaving = "" sOrderBy = "" ' Check for duplicate key bCheckKey = True sWhereChk = sWhere If x_ID = "" Or IsNull(x_ID) Then bCheckKey = False Else If sWhereChk <> "" Then sWhereChk = sWhereChk & " AND " sWhereChk = sWhereChk & "([ID] = " & AdjustSql(x_ID) & ")" End If If bCheckKey Then sSqlChk = sSql & " WHERE " & sWhereChk Set rsChk = conn.Execute(sSqlChk) If Not rsChk.Eof Then Session("ewmsg") = "Duplicate value for primary key" rsChk.Close Set rsChk = Nothing AddData = False Exit Function End If rsChk.Close Set rsChk = Nothing End If ' Add New Record If sWhere <> "" Then sWhere = sWhere & " AND " sWhere = sWhere & "(0 = 1)" sSql = sSql & " WHERE " & sWhere If sGroupBy <> "" Then sSql = sSql & " GROUP BY " & sGroupBy End If If sHaving <> "" Then sSql = sSql & " HAVING " & sHaving End If If sOrderBy <> "" Then sSql = sSql & " ORDER BY " & sOrderBy End If Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 rs.AddNew ' Field Names sTmp = Trim(x_Names) If Trim(sTmp) = "" Then sTmp = Null rs("Names") = sTmp ' Field Sex sTmp = Trim(x_Sex) If Trim(sTmp) = "" Then sTmp = Null rs("Sex") = sTmp ' Field Address1 sTmp = Trim(x_Address1) If Trim(sTmp) = "" Then sTmp = Null rs("Address1") = sTmp ' Field State sTmp = Trim(x_State) If Trim(sTmp) = "" Then sTmp = Null rs("State") = sTmp ' Field Country sTmp = Trim(x_Country) If Trim(sTmp) = "" Then sTmp = Null rs("Country") = sTmp ' Field Phone sTmp = Trim(x_Phone) If Trim(sTmp) = "" Then sTmp = Null rs("Phone") = sTmp ' Field Email sTmp = Trim(x_Email) If Trim(sTmp) = "" Then sTmp = Null rs("Email") = sTmp ' Field Comment sTmp = Trim(x_Comment) If Trim(sTmp) = "" Then sTmp = Null rs("Comment") = sTmp rs.Update rs.Close Set rs = Nothing AddData = True End Function %>