Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Email Form ASP - Want to Sort Results

    Hi,

    on my form
    http://darkstonekennel.com/webapplication.html

    I have many results to be sent via the form

    The results come back not in the order that they are listed on the application.

    I would like them to come back as listed on the form.

    Can anyone tell me how to do this?

    Thanks

    Laura

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh and I'm COMPLETELY GREEN when it comes to asp code.

    Sorry... I'm trying to learn... but its not going well.

    Heres my sendmail.asp code

    <%
    For Each x In Request.Form
    message=message & x & ": " & Request.Form(x) & CHR(10)
    Next

    set smtp = Server.CreateObject("Bamboo.SMTP")
    ' You only need to change the smtp.Rcpt ans smpt.from part to your email address
    smtp.Server = "mail.darkstonekennel.com"
    smtp.Rcpt = "laura@crestwoodscorsos.com"
    smtp.From = Request.form("email")
    smtp.FromName = Request.form("Name")
    smtp.Subject = "WebApplication"
    smtp.Message = message
    on error resume next
    smtp.Send
    if err then
    response.Write err.Description
    else
    response.Write ("Thank you for your submission.... Your message has been delivered successfully.")
    end if
    set smtp = Nothing
    %>

    Would love for someone to show me exactly what to change, where to change it

  • #3
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Well... there's two ways.

    One is to get all your form fields out by name - obviously this isn't going to be ideal if you've got thousands of fields, or if they change frequently, but it will allow you to build up the email content exactly as you wish:

    message=message &"FieldName1: " & Request.Form("FieldName1") & CHR(10)
    message=message &"FieldName2: " & Request.Form("FieldName2") & CHR(10)

    etc etc...

    The other is.. I'm not sure. Your form fields are coming through in a funny order because - I think - (a) there's no inherent ordering in a GET or POST and... it just comes through as it is... and (b) the fields are laid out in the HTML form in such a way as to make it think that IS the correct order. You could try reorganising the form layout so that the HTML form elements more closely resemble the ordering you're after; I'm not sure if giving the form elements a "tabindex" attribute might help - it's certainly the only attribute I can think of that would influence the ordering.

    Sorry if that was a load of useless waffle.

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi

    thanks for the help

    I'm assuming that

    message=message &"FieldName1: " & Request.Form("FieldName1") & CHR(10)
    message=message &"FieldName2: " & Request.Form("FieldName2") & CHR(10)


    goes toward the top where it says

    <%
    For Each x In Request.Form
    message=message & x & ": " & Request.Form(x) & CHR(10)
    Next

    and I replace the message=message.... with your suggestions?

    and do I replace each "FieldName1: " & ("FieldName1") with my item names? And do they need parenthesis around them and the " " ??

    thanks

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I"VE FIGURED IT OUT!!! YIPPIE!!!

    Thanks so much for your help!

    Laura

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok - it sorts it in my order

    but it repeats all of the entries MANY MANY times (in order) but over and over.

    how to END after last field???

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Show your current code, when it comes to a problem in code we can't help with what we cannot see.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #8
    Regular Coder
    Join Date
    Jul 2002
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <%
    For Each x In Request.Form
    message=message &"Breed: " & Request.Form("Breed") & CHR(10)
    message=message &"Name: " & Request.Form("Name") & CHR(10)
    message=message &"email: " & Request.Form("email") & CHR(10)
    message=message &"Address: " & Request.Form("Address") & CHR(10)
    message=message &"City: " & Request.Form("City") & CHR(10)
    message=message &"State/Province: " & Request.Form("State/Province") & CHR(10)
    message=message &"Zip: " & Request.Form("Zip") & CHR(10)
    message=message &"Day #: " & Request.Form("Day #") & CHR(10)
    message=message &"Eve #: " & Request.Form("Eve #") & CHR(10)
    message=message &"Cell #: " & Request.Form("Cell #") & CHR(10)
    message=message &"Best time to call: " & Request.Form("Best time to call") & CHR(10)
    message=message &"Adults: " & Request.Form("Adults") & CHR(10)
    message=message &"Children: " & Request.Form("Children") & CHR(10)
    message=message &"Other Pets: " & Request.Form("Other pets?") & CHR(10)
    message=message &"Other Pet Description: " & Request.Form("Other Pet Description") & CHR(10)
    message=message &"Vet's Name: " & Request.Form("Vet's Name") & CHR(10)
    message=message &"Vet's Address & Phone #: " & Request.Form("Vet's Address & Phone #") & CHR(10)
    message=message &"Own/Rent: " & Request.Form("Own/Rent") & CHR(10)
    message=message &"Residence Type: " & Request.Form("Residence Type") & CHR(10)
    message=message &"How long at residence: " & Request.Form("How Long at residence") & CHR(10)
    message=message &"Any plans to move: " & Request.Form("Any plans to move") & CHR(10)
    message=message &"Yard: " & Request.Form("Yard") & CHR(10)
    message=message &"Yard Description: " & Request.Form("Yard Description") & CHR(10)
    message=message &"Inside/Outside: " & Request.Form("Inside/Outside") & CHR(10)
    message=message &"Describe Shelter: " & Request.Form("Describe Shelter") & CHR(10)
    message=message &"Home during day: " & Request.Form("Home during day") & CHR(10)
    message=message &"Hours per day: " & Request.Form("Hours per day") & CHR(10)
    message=message &"Owned a dog?: " & Request.Form("Owned a dog?") & CHR(10)
    message=message &"Other Dog Description: " & Request.Form("Other dog description") & CHR(10)
    message=message &"Why a CC/Rottie: " & Request.Form("Why a CC / Rottie") & CHR(10)
    message=message &"Canine Experience: " & Request.Form("Canine experience") & CHR(10)
    message=message &"Trainer?: " & Request.Form("Trainer?") & CHR(10)
    message=message &"Activities: " & Request.Form("Activities") & CHR(10)
    message=message &"Timeframe: " & Request.Form("Timeframe") & CHR(10)
    message=message &"Purpose: " & Request.Form("Purpose") & CHR(10)
    message=message &"Male or female: " & Request.Form("Male or female") & CHR(10)
    message=message &"spay/neuter: " & Request.Form("spay/neuter") & CHR(10)
    message=message &"Color: " & Request.Form("Color") & CHR(10)
    message=message &"ears: " & Request.Form("ears") & CHR(10)
    message=message &"References: " & Request.Form("References") & CHR(10)
    message=message &"Additional Info: " & Request.Form("Add'l info") & CHR(10)
    message=message &"Signature: " & Request.Form("Signature") & CHR(10)
    Next

    set smtp = Server.CreateObject("Bamboo.SMTP")
    ' You only need to change the smtp.Rcpt ans smpt.from part to your email address
    smtp.Server = "mail.darkstonekennel.com"
    smtp.Rcpt = "laura@crestwoodscorsos.com"
    smtp.From = "laura@crestwoodscorsos.com"
    smtp.FromName = Request.form("email")
    smtp.Subject = "Puppy Application"
    smtp.Message = message
    on error resume next
    smtp.Send
    if err then
    response.Write err.Description
    else
    response.Write ("Thank you for your submission.... Your message has been delivered successfully.")
    end if
    set smtp = Nothing
    %>

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Drop these two lines:

    For Each x In Request.Form
    ...
    Next


    They cause all of the code between them to be executed once for each field in your form.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #10
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    LOL Yeah sorry - should have mentioned removing the loop

  • #11
    Regular Coder
    Join Date
    Jul 2002
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No problem!

    Thank you all for your help!

    Totally new code to me - feel sort of enlightened to have learned a bit about it now!

    Thanks again

    Laura


  •  

    Posting Permissions

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