SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Addict michael - ohio's Avatar
    Join Date
    Dec 2004
    0 Post(s)
    0 Thread(s)

    script sends formdata - need to write to file too

    Hi Folks -

    My web form calls to cgi-bin/mail.asp and does a great job of sending my form data message text everywhere I want it to go via email.

    Problem is, I also want to write (append) just the form field data to a CSV text file. I don't want or need the field names from the form or the other text that gets sent out via email.

    Can a FORM have more than one "action/method" call in it?
    Can I accomplish this from within my existing script?
    Or do I have to have the first script call a second script that parses the form data, adds, commas, opens, appends and closes the file?

    The short and simple script that I use now that sends out the email and redirects to a thankyou page is below.

    Thanks in advance for any help and/or suggestions you might have,

    - Michael

    name = Request.Form ("name")
    last_name = Request.Form ("last_name")
    city = Request.Form ("city")
    state = Request.Form ("state")
    from = Request.Form ("from")
    comments = Request.Form ("comments")
    message = message & "---- Feedback Form ----" & VBCrLF & VBCrLF
    message = message & name & " " & last_name & VBCrLf
    message = message & city & ", " & state & VBCrLf & VBCrLf
    message = message & "Email: " & from & VBCrLf & VBCrLf
    message = message & "Feedback: " & VBCrLf
    message = message & comments & VBCrLf & VBCrLf
    set smtp = Server.CreateObject("Bamboo.SMTP")
    ' You only need to change the smtp.Rcpt ans smpt.from part to your email address
    smtp.Server = ""
    smtp.Rcpt = ""
    smtp.From = from
    smtp.FromName = name
    smtp.Subject = "replace with subject"
    smtp.Message = message
    on error resume next
    if err then
     response.Write err.Description 
     response.Redirect "thankyou.htm"
    end if
    set smtp = Nothing
    Last edited by michael - ohio; Dec 8, 2004 at 22:40.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts