I have a web page that sends out an email every time the listing is approved. Some of the advertisers have more than one subcategories. I'd like to show any additional subcategories they might have in the email. At this time, I can only show the first subcategory that they are listed under. Advertiser, AdvertiserSubCategory, and SubCategories join tables. Advertiser joins AdvertiserSubCategory by AdvertiserID and AdvertiserSubCategory joins SubCategories by SubCategoryID.
'-------------------------------------------------------------
' name: GetValues()
' description: updates a record
' note: This converts all empty strings to Null values
'--------------------------------------------------------------
Sub GetValues()
AdvertiserID = rs("AdvertiserID") & ""
SubCategoryID = rs("SubCategoryID") & ""
BusinessName = rs("BusinessName") & ""
Category = rs("Category") & ""
SubCategory = rs("SubCategory") & ""
ContactPerson = rs("ContactPerson") & ""
Address = rs("Address") & ""
City = rs("City") & ""
State = rs("State") & ""
County = rs("County") & ""
Zip = rs("Zip") & ""
Phone = rs("Phone") & ""
Fax = rs("Fax") & ""
TollPhone = rs("TollPhone") & ""
CellPhone = rs("CellPhone") & ""
Email = rs("Email") & ""
Website = rs("Website") & ""
ListingType = rs("ListingType") & ""
Details = rs("Details") & ""
ShowEmail = rs("ShowEmail") & ""
Approve = rs("Approve") & ""
DateApproved = rs("DateApproved") & ""
End Sub
'-------------------------------------------------------------
' name: UpdateRecord()
' description: updates a record
' note: This converts all empty strings to Null values
'--------------------------------------------------------------
Sub UpdateRecord()
'Get values for new record
Approve = Request.Form("chkApprove")
SendEmail = Request.Form("radSendEmail")
If Approve = "0" then
rs("Approve") = true
Else
rs("Approve") = false
End If
rs("DateApproved") = Date()
'Save the record to the database
rs.Update
If SendEmail = "Yes" then
'I got some of this code from the forum application at
'www.webwiz.net
dim i
dim MyMail, EmailBody, SenderName, SenderEmail
Set MyMail = Server.CreateObject("CDO.Message")
SenderName = "ExploreNCMountains.com"
SenderEmail = "
info@...........com"
EmailBody = "Dear " & ContactPerson & ","
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p>Your Listing has been approved on ExploreNCMountains.com! Look at your information below.</p>"
If ListingType = "Standard" then
EmailBody = EmailBody & vbCrLf & vbCrLf & "<br> " & ListingType & " Listing - $150 per year."
else
EmailBody = EmailBody & vbCrLf & vbCrLf & "<br> " & ListingType & " Listing - $300 per year."
end if
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Business Name: </b>" & BusinessName & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Contact Person: </b>" & ContactPerson & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Category: </b>" & Category & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Type of Business/Organization: </b>" & SubCategory & "" - would like to display any additional subcategories that may exist.
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>County: </b>" & County & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Address: </b>" & Address & ", " & City & ", " & State & " " & Zip & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Email Address: </b><a href=""mailto:" & Email & """>" & Email & "</a>"
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Phone Number: </b>" & Phone & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Fax: </b>" & Fax & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Toll Free Phone Number: </b>" & TollPhone & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Cell Phone Number: </b>" & CellPhone & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Web Site: </b><a href=" & WebSite & ">" & WebSite & "</a>"
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Details About Business/Organization: </b>" & Details & ""
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><b>Link to Your Listing That The Public Can View: </b><a href=""
http://www.explorencmountains.com" & "/DisplayAdvertiser.aspx?ID=" & AdvertiserID & "&CatID=" & SubCategoryID & """>Go to Listing </a>"
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><a href=""
Log'>http://www.explorencmountains.com/advertiserlogin.asp"">Log In to Your Listing </a>"
EmailBody = EmailBody & vbCrLf & vbCrLf & "<p><img src=""
http://www.explorencmountains.com/explorencmountains.gif""></p>"
with MyMail
.From = SenderName & "<" & SenderEmail & ">"
.To = C