Bare with me guys. I will try and make this short and to the point. I have a website that allows students to check their admission status by submitting their email address which in turn sends them and our admissions office an email regarding their status in our SQL database. The ASP script that runs pulls all information from one table.
There are three possible status types; 'AC (App Complete), AI (App Incomplete), and UR (Under Review)'. If a student happens to be tagged as AC or UR an email is sent letting him or her know their status.
Now if the student is listed as AI, the email generated should list fields that have not been completed (described below in the code). As of right now the email is generated and sent, although fields are never listed. Just a blank space beneath "You are currently missing:".
I threw in some response.write statements to ensure data was being pulled from the database, which it appears to be doing.
Setup: Website (FrontPage), SQL 2005, MS Access 2003
Any suggestions would be great. Thanks!
[code=asp]<% @LANGUAGE = VBScript %>
<%
Option Explicit
Response.Expire s = -1
Dim Applicant
Set Applicant = Request.Form("t xtEmailAddress" )
Dim objRS
Dim strQuery
Set Session("DB") = Server.CreateOb ject("ADODB.Con nection")
Session("DB").O pen("OSC")
strQuery = "SELECT First_Name, Citizenship, College_1, College_2, College_3, GRE_Score_Date, TOEFLScore, "
strQuery = strQuery & "Transcript_1_D ate, Transcript_2_Da te, Transcript_3_Da te, Reference__1, Reference__2, Reference_3, Reference_4, "
strQuery = strQuery & "Letter_1_D ate, Letter_2_Date, Letter_3_Date, Letter_4_Date, ApplicationStat us "
strQuery = strQuery & "FROM tblAdmissionsDa ta WHERE Email = '" & Applicant & "';"
Set objRS = Session("DB").E xecute(strQuery )
If objRS.EOF = TRUE Then
response.write ("<p align='center'> <a target='_self' href='http://www.college.edu '>")
response.write ("<img alt='College' src='images/Banner.jpg' border='0'></a></p>")
response.write ("There is no record with that email address in the database.")
Else
Dim FName
Set FName = objRS(0)
Dim Citizen
Set Citizen = objRS(1)
Dim College1
Set College1 = objRS(2)
Dim College2
Set College2 = objRS(3)
Dim College3
Set College3 = objRS(4)
Dim GRE
Set GRE = objRS(5)
Dim TOEFL
Set TOEFL = objRS(6)
Dim Tran1
Set Tran1 = objRS(7)
Dim Tran2
Set Tran2 = objRS(8)
Dim Tran3
Set Tran3 = objRS(9)
Dim Ref1
Set Ref1 = objRS(10)
Dim Ref2
Set Ref2 = objRS(11)
Dim Ref3
Set Ref3 = objRS(12)
Dim Ref4
Set Ref4 = objRS(13)
Dim RefLtr1
Set RefLtr1 = objRS(14)
Dim RefLtr2
Set RefLtr2 = objRS(15)
Dim RefLtr3
Set RefLtr3 = objRS(16)
Dim RefLtr4
Set RefLtr4 = objRS(17)
Dim AdStatus
Set AdStatus = objRS(18)
Dim Body
Dim Mail
Set Mail = CreateObject("C DONTS.NewMail")
Mail.From = "user@college.e du"
Mail.To = Applicant
Mail.Bcc = "helpdesk@colle ge.edu"
Mail.Subject = "Your Admission Status"
Body = Body & "Greetings " & FName & "!" & vbCRLF & vbCRLF
Select Case AdStatus
case "AC"
Body = Body & "Your application to the College has been received and is complete." & vbCRLF
case "AI"
Body = Body & "Your application has been received but is incomplete." & vbCRLF
Body = Body & "You are currently missing:" & vbCRLF & vbCRLF
'GRE Report
If IsNull(GRE) Then
Body = Body & "GRE Score Report" & vbCRLF
Else
End If
'TOEFL Score
If Citizen <> "USA" AND IsNull(TOEFL) Then
Body = Body & "TOEFL Score" & vbCRLF
Else
End If
'Reference Letters
If Citizen = "USA" Then 'Main loop
If IsNull(RefLtr1) AND IsNull(RefLtr2) Then
Body = Body & "2 Reference Letters" & vbCRLF
ElseIf IsNull (RefLtr2) Then
Body = Body & "A Reference Letter has been received from " & Ref1 & ". One additional letter is required." & vbCRLF
End If
Else 'Main loop
If IsNull(RefLtr1) AND IsNull(RefLtr2) Then
Body = Body & "2 Reference Letters" & vbCRLF
ElseIf IsNull(RefLtr2) Then
Body = Body & "A Reference Letter has been received from " & Ref1 & ". One additional letter is required." & vbCRLF
End If
End if 'Main loop
'Transcripts
If (IsNull(College 1)=FALSE) AND IsNull(Tran1) Then
Body = Body & "Transcript for " & College1 & vbCRLF
Else
End If
If (IsNull(College 2)=FALSE) AND IsNull(Tran2) Then
Body = Body & "Transcript for " & College2 & vbCRLF
Else
End If
If (IsNull(College 3)=FALSE) AND IsNull(Tran3) Then
Body = Body & "Transcript for " & College3 & vbCRLF
Else
End If
Body = Body & vbCRLF & "Please note the deadline for submission of all application materials for international applicants is December 1." & vbCRLF
case "UR"
Body = Body & "Your application to the College has been forwarded to the Admissions Committee for review." & vbCRLF
case else
Body = Body & "No application has been received." & vbCRLF
End Select
Body = Body & vbCRLF & "Thank you," & vbCRLF & vbCRLF & "User" & vbCRLF & "The Program" & vbCRLF & "The College" & vbCRLF & "College" & vbCRLF & "user@college.e du"
Mail.Body = Body
Mail.Send
set Mail = nothing
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Status Result</title>
</head>
<body>
<p align="center"> <a target="_self" href="http://www.college.edu ">
<img alt="The College" src="http://www.college.edu/images/Banner.jpg" border="0"></a></p>
<br>
<font face="arial, sans serif,helvetica " size="2"><p>
<%
response.write (FName)
response.write (",<br><br>" )
response.write ("Your admission status has been emailed to you at ")
response.write (Applicant)
objRS.close
Session("DB").c lose
Set objRS = Nothing
Set Session("DB") = Nothing
Set FName = Nothing
Set Citizen = Nothing
Set College1 = Nothing
Set College2 = Nothing
Set College3 = Nothing
Set GRE = Nothing
Set TOEFL = Nothing
Set Tran1 = Nothing
Set Tran2 = Nothing
Set Tran3 = Nothing
Set Ref1 = Nothing
Set Ref2 = Nothing
Set Ref3 = Nothing
Set Ref4 = Nothing
Set RefLtr1 = Nothing
Set RefLtr2 = Nothing
Set RefLtr3 = Nothing
Set RefLtr4 = Nothing
Set AdStatus = Nothing
End If
%>
</p>
<p>
Thank you,<br>
College <br>
Office of Admissions<br>
<a href="mailto:us er@college.edu? subject=Admissi ons">user@colle ge.edu</a><br>
<a href="http://www.college.edu "</a></p>
</font></body>
</html>[/code]
There are three possible status types; 'AC (App Complete), AI (App Incomplete), and UR (Under Review)'. If a student happens to be tagged as AC or UR an email is sent letting him or her know their status.
Now if the student is listed as AI, the email generated should list fields that have not been completed (described below in the code). As of right now the email is generated and sent, although fields are never listed. Just a blank space beneath "You are currently missing:".
I threw in some response.write statements to ensure data was being pulled from the database, which it appears to be doing.
Setup: Website (FrontPage), SQL 2005, MS Access 2003
Any suggestions would be great. Thanks!
[code=asp]<% @LANGUAGE = VBScript %>
<%
Option Explicit
Response.Expire s = -1
Dim Applicant
Set Applicant = Request.Form("t xtEmailAddress" )
Dim objRS
Dim strQuery
Set Session("DB") = Server.CreateOb ject("ADODB.Con nection")
Session("DB").O pen("OSC")
strQuery = "SELECT First_Name, Citizenship, College_1, College_2, College_3, GRE_Score_Date, TOEFLScore, "
strQuery = strQuery & "Transcript_1_D ate, Transcript_2_Da te, Transcript_3_Da te, Reference__1, Reference__2, Reference_3, Reference_4, "
strQuery = strQuery & "Letter_1_D ate, Letter_2_Date, Letter_3_Date, Letter_4_Date, ApplicationStat us "
strQuery = strQuery & "FROM tblAdmissionsDa ta WHERE Email = '" & Applicant & "';"
Set objRS = Session("DB").E xecute(strQuery )
If objRS.EOF = TRUE Then
response.write ("<p align='center'> <a target='_self' href='http://www.college.edu '>")
response.write ("<img alt='College' src='images/Banner.jpg' border='0'></a></p>")
response.write ("There is no record with that email address in the database.")
Else
Dim FName
Set FName = objRS(0)
Dim Citizen
Set Citizen = objRS(1)
Dim College1
Set College1 = objRS(2)
Dim College2
Set College2 = objRS(3)
Dim College3
Set College3 = objRS(4)
Dim GRE
Set GRE = objRS(5)
Dim TOEFL
Set TOEFL = objRS(6)
Dim Tran1
Set Tran1 = objRS(7)
Dim Tran2
Set Tran2 = objRS(8)
Dim Tran3
Set Tran3 = objRS(9)
Dim Ref1
Set Ref1 = objRS(10)
Dim Ref2
Set Ref2 = objRS(11)
Dim Ref3
Set Ref3 = objRS(12)
Dim Ref4
Set Ref4 = objRS(13)
Dim RefLtr1
Set RefLtr1 = objRS(14)
Dim RefLtr2
Set RefLtr2 = objRS(15)
Dim RefLtr3
Set RefLtr3 = objRS(16)
Dim RefLtr4
Set RefLtr4 = objRS(17)
Dim AdStatus
Set AdStatus = objRS(18)
Dim Body
Dim Mail
Set Mail = CreateObject("C DONTS.NewMail")
Mail.From = "user@college.e du"
Mail.To = Applicant
Mail.Bcc = "helpdesk@colle ge.edu"
Mail.Subject = "Your Admission Status"
Body = Body & "Greetings " & FName & "!" & vbCRLF & vbCRLF
Select Case AdStatus
case "AC"
Body = Body & "Your application to the College has been received and is complete." & vbCRLF
case "AI"
Body = Body & "Your application has been received but is incomplete." & vbCRLF
Body = Body & "You are currently missing:" & vbCRLF & vbCRLF
'GRE Report
If IsNull(GRE) Then
Body = Body & "GRE Score Report" & vbCRLF
Else
End If
'TOEFL Score
If Citizen <> "USA" AND IsNull(TOEFL) Then
Body = Body & "TOEFL Score" & vbCRLF
Else
End If
'Reference Letters
If Citizen = "USA" Then 'Main loop
If IsNull(RefLtr1) AND IsNull(RefLtr2) Then
Body = Body & "2 Reference Letters" & vbCRLF
ElseIf IsNull (RefLtr2) Then
Body = Body & "A Reference Letter has been received from " & Ref1 & ". One additional letter is required." & vbCRLF
End If
Else 'Main loop
If IsNull(RefLtr1) AND IsNull(RefLtr2) Then
Body = Body & "2 Reference Letters" & vbCRLF
ElseIf IsNull(RefLtr2) Then
Body = Body & "A Reference Letter has been received from " & Ref1 & ". One additional letter is required." & vbCRLF
End If
End if 'Main loop
'Transcripts
If (IsNull(College 1)=FALSE) AND IsNull(Tran1) Then
Body = Body & "Transcript for " & College1 & vbCRLF
Else
End If
If (IsNull(College 2)=FALSE) AND IsNull(Tran2) Then
Body = Body & "Transcript for " & College2 & vbCRLF
Else
End If
If (IsNull(College 3)=FALSE) AND IsNull(Tran3) Then
Body = Body & "Transcript for " & College3 & vbCRLF
Else
End If
Body = Body & vbCRLF & "Please note the deadline for submission of all application materials for international applicants is December 1." & vbCRLF
case "UR"
Body = Body & "Your application to the College has been forwarded to the Admissions Committee for review." & vbCRLF
case else
Body = Body & "No application has been received." & vbCRLF
End Select
Body = Body & vbCRLF & "Thank you," & vbCRLF & vbCRLF & "User" & vbCRLF & "The Program" & vbCRLF & "The College" & vbCRLF & "College" & vbCRLF & "user@college.e du"
Mail.Body = Body
Mail.Send
set Mail = nothing
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Status Result</title>
</head>
<body>
<p align="center"> <a target="_self" href="http://www.college.edu ">
<img alt="The College" src="http://www.college.edu/images/Banner.jpg" border="0"></a></p>
<br>
<font face="arial, sans serif,helvetica " size="2"><p>
<%
response.write (FName)
response.write (",<br><br>" )
response.write ("Your admission status has been emailed to you at ")
response.write (Applicant)
objRS.close
Session("DB").c lose
Set objRS = Nothing
Set Session("DB") = Nothing
Set FName = Nothing
Set Citizen = Nothing
Set College1 = Nothing
Set College2 = Nothing
Set College3 = Nothing
Set GRE = Nothing
Set TOEFL = Nothing
Set Tran1 = Nothing
Set Tran2 = Nothing
Set Tran3 = Nothing
Set Ref1 = Nothing
Set Ref2 = Nothing
Set Ref3 = Nothing
Set Ref4 = Nothing
Set RefLtr1 = Nothing
Set RefLtr2 = Nothing
Set RefLtr3 = Nothing
Set RefLtr4 = Nothing
Set AdStatus = Nothing
End If
%>
</p>
<p>
Thank you,<br>
College <br>
Office of Admissions<br>
<a href="mailto:us er@college.edu? subject=Admissi ons">user@colle ge.edu</a><br>
<a href="http://www.college.edu "</a></p>
</font></body>
</html>[/code]
Comment