[thelist] ASP and form question

Michael K. Ahn mike at ahnfire.com
Mon Jul 8 18:13:01 CDT 2002


Hey,

Make sure the FORM field's method is POST and not GET and also that the
names are typed exactly the way you are trying to retrieve them in your
script.

Also, you may want to change your ASP code to something like this:
objMail.Body  = "Sent by: " & Request.Form("fullname") & vbCrlf & vbCrlf
& _
	"address: " & Request.Form("address") & vbCrlf & vbCrlf & _
	"city: " & Request.Form("city") & vbCrlf & vbCrlf & _
	"state: " & Request.Form("state") & vbCrlf & vbCrlf & _
etc. etc.

This will make your code more readable and not constantly call the
objMail object to update it multiple times.  IMHO, that is.

Michael

-----Original Message-----
From: Sharon F. Malone [mailto:sfmalo at 24caratdesign.com]
Sent: Monday, July 08, 2002 7:05 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] ASP and form question

Hi Lon, Joel, Mahu, and everyone who is trying to help me!!!

Well! Progress. I combined Lon's suggested strBody suggestions with
Joel's script (after looking back over Madhu's script)(<8 and changed
all the objMail.Body references to strBody followed by objMail.Body =
strBody.

I am now getting no compilation errors and the email message I'm getting
looks like this:
Sent by:

address:

city:

state:

zip:

homephone:

workphone:

fax:

email:

BestSellers:

SpecialtyGifts:

SeasonalSelections:

CorporateGifts:

PartyFavors:

OtherItems:

Comments:

Progress!!!! The only problem is, it's still not picking up the
information I typed into these fields as a test.

Here's the script so far. Maybe I should take out the <input type=hidden
fields> in my form. Could that be interfering?

<%
Dim objMail
set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = "webmaster at 24caratdesign.com"
objMail.Subject = "Web Site Form Request"
objMail.To = "The Chocolate Factory<sfmalo at 24caratdesign.com>"
objMail.BCC = "cheftrain at yahoo.com"

strBody  = "Sent by: " & Request.Form("fullname")     & vbCrlf & vbCrlf
strBody  = strBody  & "address: " & Request.Form("address")     & vbCrlf
& vbCrlf
strBody  = strBody  & "city: " & Request.Form("city")     & vbCrlf &
vbCrlf
strBody  = strBody  & "state: " & Request.Form("state")     & vbCrlf
& vbCrlf
strBody  = strBody  & "zip: " & Request.Form("zip")     & vbCrlf &
vbCrlf
strBody  = strBody  & "homephone: " & Request.Form("homephone")     &
vbCrlf & vbCrlf
strBody  = strBody  & "workphone: " & Request.Form("workphone")     &
vbCrlf & vbCrlf
strBody  = strBody  & "fax: " & Request.Form("fax")     & vbCrlf &
vbCrlf
strBody  = strBody  & "email: " & Request.Form("email")     & vbCrlf &
vbCrlf
strBody  = strBody  & "BestSellers: " & Request.Form("BestSellers")
& vbCrlf & vbCrlf
strBody  = strBody  & "SpecialtyGifts: " &
Request.Form("SpecialtyGifts")     & vbCrlf & vbCrlf
strBody  = strBody  & "SeasonalSelections: " &
Request.Form("SeasonalSelections")     & vbCrlf & vbCrlf
strBody  = strBody  & "CorporateGifts: " &
Request.Form("CorporateGifts")     & vbCrlf & vbCrlf
strBody  = strBody  & "PartyFavors: " & Request.Form("PartyFavors")
& vbCrlf & vbCrlf
strBody  = strBody  & "OtherItems: " & Request.Form("OtherItems")     &
vbCrlf & vbCrlf
strBody  = strBody  & "Comments: " & Request.Form("Comments")

objMail.Body = strBody
objMail.Send
set objMail = nothing
Response.Redirect("http://www.chefsteve.com/chocfoundry/html/confirm.htm
l")
%>
------------------------------------------------------------------------
---
Sharon F. Malone
"web design and Internet writing services"
http://www.24caratdesign.com
sfmalo at 24caratdesign.com
----- Original Message -----
From: "lon.kraemer" <lwkraemer at directvinternet.com>
To: <thelist at lists.evolt.org>
Sent: Monday, July 08, 2002 10:21 AM
Subject: Re: [thelist] ASP and form question


> Hi Sharon,
>
> Please DELETE and forget the script that headlemur sent you. It'll
only
> confuse you at this point. He showed that to me about 5 years ago. I
> told him it was overkill then. It still is! No offense intended Alan
;)
>
> Here is a VERY simple[0] example that should get you going using the
> CDONTS.NewMail object:
>
> Save this as form.html
> ------------
> <html>
> <head>
> <title>form.html</title>
> </head>
> <body>
> <form action="processform.asp" method="post">
> Full Name: <input type="text" name="fullname"><br>
> Email Address: <input type="text" name="emailaddress"><br>
> Message:<br>
> <textarea cols="40" rows="4" name="message"></textarea><br>
> <input type="submit">
> </form>
> </body>
> </html>
> -------------
>
> Save this as processform.asp
> -------------
> <%
> Dim fromname,fromemail,frommessage,objMail,strBody
> fromname=request.form("fullname")
> fromemail=request.form("emailaddress")
> frommessage=request.form("message")
> Set objMail = Server.CreateObject("CDONTS.NewMail")
> objMail.From = fromemail
> objMail.To = "Sharon F. Malone<sharon at herdomain.com>"
> objMail.Subject = "Form response email"
>
> strBody = "Name: " & fromname & vbCrLf
> strBody = strBody & "...whose email is: " & fromemail & vbCrLf
> strBody = strBody & "...said: " & frommessage & vbCrLf
>
> objMail.Body = strBody
> objMail.Send
> Set objMail = Nothing 'You must always do this with CDONTS.
> Response.Redirect("thanks.html")
>  %>
> ------------
>
> Save this as thanks.html
> ------------
> <html>
> <head>
> <title>thanks.html</title>
> </head>
> <body>
> Your email has been sent.
> </body>
> </html>
> -------------
>
> [0] This uses three separate pages, but could easily be just a single
> page. There is no form validation or object error handling. It uses
> minimal object methods.
>
> You might also just be well advised to Google "CDONTS" for more
complete
> info.
>
> HTH
> --
> Lon Kraemer
> -----------------------------------------
>
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !



More information about the thelist mailing list