<% ' ' Filename: Contact.asp ' Generated with CodeCharge 2.0.1 ' ASP 2.0 & Templates.ccp build 9/6/2001 ' '------------------------------- ' Contact CustomIncludes begin %> <% ' Contact CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "Contact.asp" sTemplateFileName = "Contact.html" '=============================== '=============================== ' Contact PageSecurity begin ' Contact PageSecurity end '=============================== '=============================== ' Contact Open Event begin ' Contact Open Event end '=============================== '=============================== ' Contact OpenAnyPage Event begin ' Contact OpenAnyPage Event end '=============================== '=============================== 'Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' Contact Show begin '=============================== ' Perform the form's action '------------------------------- ' Initialize error variables '------------------------------- sFormErr = "" '------------------------------- ' Select the FormAction '------------------------------- Select Case sForm Case "Form" FormAction(sAction) end select '=============================== '=============================== ' Display page '------------------------------- ' Load HTML template for this page '------------------------------- LoadTemplate sAppPath & sTemplateFileName, "main" '------------------------------- ' Load HTML template of Header and Footer '------------------------------- '------------------------------- SetVar "FileName", sFileName '------------------------------- ' Step through each form '------------------------------- Form_Show '------------------------------- ' Process page templates '------------------------------- Parse "main", False '------------------------------- ' Output the page to the browser '------------------------------- Response.write PrintVar("main") ' Contact Show end '------------------------------- ' Destroy all object variables '------------------------------- cn.Close Set cn = Nothing UnloadTemplate '=============================== '=============================== ' Contact Close Event begin ' Contact Close Event end '=============================== '=============================== ' Action of the Record Form '------------------------------- Sub FormAction(sAction) '------------------------------- ' Initialize variables '------------------------------- Dim bExecSQL: bExecSQL = true Dim sActionFileName : sActionFileName = "" Dim sWhere : sWhere = "" Dim bErr : bErr = False Dim pPKE_Key : pPKE_Key = "" Dim fldFirst : fldFirst = "" Dim fldLast : fldLast = "" Dim fldEmail : fldEmail = "" Dim fldComments : fldComments = "" '------------------------------- '------------------------------- ' Form Action begin '------------------------------- sActionFileName = "Contact.asp" '------------------------------- ' Load all form fields into variables '------------------------------- fldFirst = GetParam("First") fldLast = GetParam("Last") fldEmail = GetParam("Email") fldComments = GetParam("Comments") '------------------------------- ' Validate fields '------------------------------- if sAction = "insert" or sAction = "update" then '------------------------------- ' Form Check Event begin ' Form Check Event end '------------------------------- If len(sFormErr) > 0 then exit sub end if end if '------------------------------- '------------------------------- ' Create SQL statement '------------------------------- select case sAction case "insert" '------------------------------- ' Form Insert Event begin ' '------------------------------- '------------------------------ ' Mailer to Web Admin begin '------------------------------ Dim objCDO Set objCDO = Server.CreateObject("CDONTS.NewMail") objCDO.To = "ADarnell@mpmdpc.com" objCDO.From = GetParam("Email") objCDO.Subject = "www.mpmdpc.com Contact Page Results" & GetParam("Email") objCDO.Body = GetParam("First") & " " & GetParam("Last") _ & chr(13) & chr(13) & GetParam("Comments") objCDO.MailFormat = 0 objCDO.Send set objCDO = nothing '------------------------------ ' Mailer to Web Admin End ' Mailer to Client Begin '------------------------------ Set objCDO = Server.CreateObject("CDONTS.NewMail") objCDO.To = GetParam("Email") objCDO.From = "ADarnell@mpmdpc.com" objCDO.Subject = "Contact Form on www.mpmdpc.com" objCDO.Body = GetParam("First") & " " & GetParam("Last") _ & chr(13) & chr(13) & "Thank you for visiting our web site! We appreciate your interest and feedback." objCDO.MailFormat = 0 objCDO.Send set objCDO = nothing '------------------------------ ' Mailer to Client Begin '------------------------------ end select '------------------------------- 'Form Insert Event end '------------------------------- '------------------------------- ' Form BeforeExecute Event begin ' Form BeforeExecute Event end '------------------------------- '------------------------------- ' Execute SQL statement '------------------------------- '------------------------------- ' Form Action end '------------------------------- end sub '=============================== '=============================== ' Display Record Form '------------------------------- Sub Form_Show() '------------------------------- ' Form Show begin '------------------------------- Dim sWhere : sWhere = "" Dim sFormTitle: sFormTitle = "" Dim bPK : bPK = True '------------------------------- ' Load primary key and form parameters '------------------------------- if sFormErr = "" then pE_Key = GetParam("E_Key") SetVar "FormError", "" else fldFirst = GetParam("First") fldLast = GetParam("Last") fldEmail = GetParam("Email") fldComments = GetParam("Comments") fldE_Key = GetParam("E_Key") pE_Key = GetParam("PK_E_Key") SetVar "sFormErr", sFormErr SetVar "FormTitle", sFormTitle Parse "FormError", False end if '------------------------------- '------------------------------- ' Load all form fields '------------------------------- '------------------------------- ' Build WHERE statement '------------------------------- '------------------------------- ' Form Open Event begin ' Form Open Event end '------------------------------- SetVar "FormTitle", sFormTitle '------------------------------- ' Build SQL statement and open recordset '------------------------------- '------------------------------- '------------------------------- ' Load all fields into variables from recordset or input parameters '------------------------------- '------------------------------- ' Load data from recordset when form displayed first time '------------------------------- '------------------------------- ' Form ShowEdit Event begin ' Form ShowEdit Event end '------------------------------- '------------------------------ ' Form ShowInsert Event begin ' Form ShowInsert Event end '------------------------------- '------------------------------ ' Form Show Event begin ' Form Show Event end '------------------------------- '------------------------------- ' Show form field '------------------------------- '------------------------------- ' Form Close Event begin ' Form Close Event end '------------------------------- '------------------------------- ' Form Show end '------------------------------- End Sub '=============================== %>