2 Replies - 1806 Views - Last Post: 25 July 2006 - 04:40 PM Rate Topic: -----

#1 itsjules  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-July 06

Submitting huge ASPMail forms

Posted 21 July 2006 - 01:22 PM

I have created HUGE order forms for a client using HTML (Dreamweaver Studio MX 2004) for the forms and ASPMail for the submission of the forms. Everything works fine, except ALL the fields are submitted with every order, and I want ONLY the fields that have something in them to be submitted.

Right now my client gets a huge list of all the fields in the forms with most of them blank and a few with numbers denoting how many items a customer wants to order.

The main problem is that I'm not technically a programmer--I'm trying really hard to learn on my own, and it's difficult.

Here's the code from my "form action" page--Please be aware that to protect my client's privacy, I've replace all instances of his name and email address/domain name with "client@domain.com", etc.



 <%
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Order"
Mailer.FromAddress= "root@domain.com"
Mailer.RemoteHost = "mail.domain.com"
Mailer.AddRecipient "ClientName", "client@domain.com"
Mailer.Subject = "Order"
strMsgHeader = "Form Information Follows: " & vbCrLf
for i = 1 to Request.Form.Count
strMsgInfo = strMsgInfo & Request.Form.Key(i) & " - " & Request.Form.Item(i) & vbCrLf
next
strMsgFooter = vbCrLf & "End of form information"
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter

if Mailer.SendMail then
  Response.Write "Thank you for using our online ordering system. You will be sent an invoice via email which you may pay online."
else
  Response.Write "Mail send failure. Error was " & Mailer.Response
end if
set Mailer = Nothing
%>





Any help anyone could provide would be greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: Submitting huge ASPMail forms

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Submitting huge ASPMail forms

Posted 21 July 2006 - 03:00 PM

for i = 1 to Request.Form.Count
   if Request.Form.Item(i)<>"" then
	  strMsgInfo = strMsgInfo & Request.Form.Key(i) & " - " & Request.Form.Item(i) & vbCrLf
   end if
next


This of course assumes that the variable grabbed by Item(i) is the actual field. The modified code checks to see if there is any text entered in the field.
Was This Post Helpful? 0
  • +
  • -

#3 itsjules  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-July 06

Re: Submitting huge ASPMail forms

Posted 25 July 2006 - 04:40 PM

To Amadeus:

THANKS!! :D You're a genius and that worked and I'm SO grateful to you for taking the time to help me. Especially since your help WORKED!!

You rock; thanks again SO much!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1