Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 17th, 2004, 10:56 AM
Authorized User
 
Join Date: Jul 2004
Location: Chicago, , .
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Night_Zero
Default Submit Button

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="hidden@hidden.com"
                objMail.From= "data@hidden.com"
                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>

Reply With Quote
  #2 (permalink)  
Old August 17th, 2004, 04:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

hmm.. Initiated on the other thread?:) In a way, it is nice to see the page fit into the screen.

Okay, You made 2 mistakes there...

1) Change it as this.
Code:
if request("Send") = "Send" Then
2) Use a Response.write here, as that part of code goes within <% %>
tags
Code:
Response.write "<input type='submit' value='Send' name='Send'>"
Hope this helps and lets you finish it on time.
Cheers!


_________________________
- Vijay G
Strive for Perfection
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Submit button not fired. r_taduri ASP.NET 2.0 Professional 1 August 30th, 2006 12:51 AM
Make a image button as default submit button toshi ASP.NET 1.0 and 1.1 Basics 1 June 1st, 2006 05:25 AM
Submit Button trusslady Infopath 2 January 6th, 2006 05:19 PM
submit-button grstad Javascript How-To 1 May 25th, 2005 08:33 AM



All times are GMT -4. The time now is 10:55 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.