[thelist] ASP and form question

Sharon F. Malone sfmalo at 24caratdesign.com
Mon Jul 8 18:28:01 CDT 2002


Thanks for the suggestion, Michael. I've doublechecked my form field names but I'll check again. The method has always been POST for this form. Again, I wonder if I should get rid of the <input type=hidden> declarations I now have in the form. url is:
http://www.chefsteve.com/chocfoundry/html/order.html

Since I've changed objMail.Body to strBody, I take it that your shortened method below would work just as well? Or, do strBody's have to be written out individually for some reason?

Sharon

On Monday, July 08, 2002 4:12 PM Michael K. Ahn wrote:

> 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.
---------------------------------------------------------------------------
Sharon F. Malone
"web design and Internet writing services"
http://www.24caratdesign.com
sfmalo at 24caratdesign.com




More information about the thelist mailing list