Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2004, 06:34 AM
Registered User
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default submit to asp

this is probally really easy for someone whos has intermediate knowledge of asp, but for someone who doesn't, it looks like im reading Greek. lol

Needed a script for an email form.
A friend of my mine referred me to aspin.com to download a script. It has 3 files:

contact.asp (a simple form)
contact2.asp (main code?)
thanks.asp (validation page)

i dont need the form created, i have already done so in dw. All i need now is to link the "submit" button to contact2.asp right? tried linking it like a url to see if it would at least try and process the code, but that doesnt want to work. I still havent changed anything in the contact2 file. I have no clue how. heres the code.. what would i modify and how would link the submit button to it? if not thats ok too.

<%

name = request.form("name")
email = request.form("email")
message = request.form("message")

If name="" or email="" or message="" Then
url = "contact.asp?reqd=* indicates required field&name=" & name & "&email=" & email & "&message=" & message
If name="" Then
url = url & "&mname=*"
End if

If email="" Then
url = url & "&memail=*"
End if

If message="" Then
url = url & "&mmessage=*"
End if


response.redirect url & "&foobar=foobar#form"
response.end
End if


Dim objCDONTS ' Email object
Dim strFromName ' From persons' real name
Dim strFromEmail, strToEmail ' Email addresses
Dim strSubject, strBody ' Message
Dim misccompo


strSubject = "ENTER YOUR SUBJECT HERE"
strFromName = Trim(Request.Form("name"))
strFromEmail = Trim(Request.Form("email"))
strToEmail = "ENTER YOUR EMAIL ADDRESS HERE"
strBody = Trim(Request.Form("message"))

Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
objCDONTS.From = strFromName & " <" & strFromEmail & ">"
objCDONTS.To = strToEmail
objCDONTS.Subject = strSubject
objCDONTS.Body = "--------------------------------------" & vbcrlf & vbcrlf & strbody & vbcrlf & vbcrlf & vbcrlf & "--------------------------------------------------------------" & vbcrlf & "MESSAGE ENDS: End of message"
objCDONTS.Send
Set objCDONTS = Nothing

response.redirect "thanks.asp"
response.end
%>


i see 2 spots that tell me to enter an email and a subject... but what else would i have to modify? I realize that this might sound like too much, so in that event could u kindly link me to a good newbie tut site where i could learn for myself what the bits of this code mean? One more question i have. my original html form consists of more text fields then the contact.asp does. Do i also have to modify contact2 to accomodate those extra fields?

i am not your **************** bitch.. please put down those stockings.
 
Old April 13th, 2004, 07:01 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Can you get the script to work as it is now (including the form thar came with it)? If I were you, I'd get that to work first before you start making changes. That way, you can check whether your setup supports sending e-mail.

You can also take a look at this article: http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=249

It explains how to send e-mail from ASP pages, and the code in the first part looks pretty much like the code you have posted now.

HtH and if not, let me know....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Ball And Biscuit by The White Stripes (Track 8 from the album: Elephant)






Similar Threads
Thread Thread Starter Forum Replies Last Post
submit a form at ASP server side NewLuna1 Classic ASP Basics 1 March 25th, 2007 07:23 AM
ASP Button Submit netpicker9 ASP.NET 2.0 Basics 0 November 16th, 2006 07:10 PM
having two submit buttons in asp page and passing KGANESH2006 Classic ASP Basics 1 April 24th, 2006 09:58 PM
Thank you popup window after asp submit? kbuska Classic ASP Basics 1 September 20th, 2004 06:35 PM
Issue with dropdown list and submit - ASP.NET Montenegro ASP.NET 1.0 and 1.1 Basics 0 March 24th, 2004 04:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.