<%
Dim sConnection, objConn , objRS
If request.form("cmdSubmit") = "Submit" then
name = request.form("name")
name = Replace(name, "'", "''")
email = request.form("email1")
phone = request.form("phone")
' refer = request.form("refer")
location = request.form("location")
referral = request.form("referral")
tm = time
tm2 = right(tm,2)
If tm2 = "AM" then
mth = Month(date-1)
dy = Day(date-1)
yr = Year(date-1)
Else
mth = Month(date)
dy = Day(date)
yr = Year(date)
End If
If dy < 10 then
dy = "0" & dy
End If
If mth < 10 then
mth = "0" & mth
End If
date_ent = yr & "-" & mth & "-" & dy
id = 0
If location = "Edmonton" then
id = 1
End If
If location = "Rolling Meadows" then
id = 2
End If
If location = "Ft. Lauderdale" then
id = 5
End If
If location = "Orange County" then
id = 4
End If
If location = "San Diego" then
id = 3
End If
If id > 0 then
sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=ptmxhosting_; UID=member;PASSWORD=pass1234; OPTION=3"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(sConnection)
Newatt = "INSERT INTO workshop(Name, Email, Phone, Location, Referral, Date_ent) VALUES('" & name & "', '" & email & "', '" & phone & "', '" & location & "', '" & referral & "', '" & date_ent & "')"
objConn.Execute(Newatt)
If err.number > 0 then
Response.Write "Database Insert Error"
Response.End
End If
call sendemail
Response.Write "Thank You! "
Response.Redirect "continue.asp"
Else
%>
Please select location where you will attend
<%
End If
End If
%>
<%
sub sendemail
sqlstmt = "Select * from letters where ID = " & id
Set RS = objConn.execute(sqlstmt)
csubject = RS("Subject")
cbody = "Hello " & name & RS("Text")
cemail = email
Const cdoSendUsingPort = 2
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
Dim MyMail
Set MyMail = Server.CreateObject("CDO.Message")
With MyMail
.Configuration = iConf
.From = "Powerteam International"
.To = cemail
.Subject = csubject
.TextBody = cbody
.Send()
End With
Set MyMail = Nothing
End Sub
%>