I need to make this submit button work in the form. I want test.asp to display a page with all the check boxes and then have a submit button. After you hit the submit button on that page it redirects you to success.asp that tells you which emails it sent too. If you take out the code in the first <% %> and the submit button code that is commented out it displays all the names correctly and check boxes but I can't get the submit to work. I keep getting the error about an expected statement on that line or on one around. I believe that the email part itself redirects you to success.asp so all that the submit needs to do is actually execute the email code but I can't get it to do that. After the submit works this program will finally be done. Help please...
<%Option Explicit%>
<HTML>
<HEAD>
<TITLE>Password Updater</TITLE>
</HEAD>
<BODY>
<%
if request(Send) = Send Then
Dim arrEmails, strSelectedDetails, objMail
strSelectedDetails = Request.Form("chkEmails")
If len(trim(strSelectedDetails))>0 then
Set objMail = Server.CreateObject("CDONTS.NewMail")
arrEmails = Split(strSelectedDetails)
for j=0 to Ubound(arrEmails)
arrTemp=split(arrEmails(j),"_")
strEmail=arrTemp(0)
strUserName=arrTemp(1)
strPassword=arrTemp(2)
strLogin=arrTemp(3)
objMail.To="
[email protected]"
objMail.From= "
[email protected]"
objMail.Subject= "Password Change"
objMail.Body= "Your online and FTP password has now expired. Please update your records to reflect the following login and new password: "<br>" "<br>" Login: " & strLogin & " "<br>" Password: " & strPassword & ". Attached you will find instructions for changing your password if you use CoffeeCup Free FTP. If you are using a different FTP client software, please consult your MIS department for assistance. "<br>" If you have any questions, please feel free to contact our Client Service Team at hidden. "<br>"Thank you! "<br>" Data Services "<br>" Hidden "<br>" hidden "
objMail.AttachFile server.mappath("Changing-Passwords-in-CoffeeCup-Free-FTP.pdf")
objMail.Send
next
Set objMail = nothing
Response.Redirect("Success.asp?MailSentTo=" & strSelectedDetails)
Else
Response.Write "No Selection made for sending emails"
End If
End If
%>
<%
dim cn, sql, rs
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\inetpub\database\ftp.mdb;" & _
"Jet OLEDB:System Database=\\matrix\database\dent32\dent32.mdw" , _
"Hidden", "Hidden"
set rs = server.createobject("adodb.recordset")
sql = "SELECT PASSWORD.Password, PASSWORD.IsCurrent, PASSWORD.Assigned, PASSWORD.ID, CLIENT_CONTACTS.[CONTACT EMAIL], CLIENT.[CLIENT NAME] " & _
"FROM [PASSWORD], CLIENT_CONTACTS, CLIENT " & _
"WHERE (((PASSWORD.IsCurrent)=-1) AND ((PASSWORD.Assigned)=#4/16/04#) AND ((PASSWORD.ID)=[CLIENT_CONTACTS].[CLIENT ID] And (PASSWORD.ID)=[CLIENT].[CLIENT ID]));"
response.write("<h3>Check the check box if you would like to email the client his or her password then hit send</h3>")
rs.Open sql, cn
Response.write "<form name='frm1' action='test.asp' method='post'>"
while not rs.eof
Response.write "<input type='checkbox' name='chkEmails' value='" & rs("CONTACT EMAIL") & "_" & rs("CLIENT NAME") & "_" & rs("Password") & "_" & rs("ID") & "'>"
response.write rs("ClIENT NAME") & " " & " "
response.write rs("ID") & " " & "<br>"
response.write rs("CONTACT EMAIL") & "<br>" & "<br>"
rs.movenext
wend
'SUBMIT BUTTON CODE <input type="submit" value="Send" name="Send">
Response.write "</form>"
rs.close
set rs = nothing
%>
</BODY>
</HTML>