OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

Using CDONTS on same page as submission form

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Using CDONTS on same page as submission form
Page: [1]
 
 
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
Using CDONTS on same page as submission form - 6/19/2003 16:27:32   
I want to put a CDONTS script on the same page as my submission form. The problem I have is that as soon as I load the page, the script executes and sends a blank email. Here is a copy of the top of my page. Can I move the CDONTS script elsewhere on the page so it executes at the right time or can I edit the script so it won' t fire until the user clicks submit?

<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next

strErrorUrl = " "

If Request.ServerVariables(" REQUEST_METHOD" ) = " POST" Then
If Request.Form(" VTI-GROUP" ) = " 0" Then
Err.Clear

Set fp_conn = Server.CreateObject(" ADODB.Connection" )
FP_DumpError strErrorUrl, " Cannot create connection"

Set fp_rs = Server.CreateObject(" ADODB.Recordset" )
FP_DumpError strErrorUrl, " Cannot create record set"

fp_conn.Open Application(" TeamInfo_ConnectionString" )
FP_DumpError strErrorUrl, " Cannot open database"

fp_rs.Open " Results" , fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, " Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, " Cannot add new record set to the database"
Dim arFormFields0(10)
Dim arFormDBFields0(10)
Dim arFormValues0(10)

arFormFields0(0) = " FName"
arFormDBFields0(0) = " FName"
arFormValues0(0) = Request(" FName" )
arFormFields0(1) = " LName"
arFormDBFields0(1) = " LName"
arFormValues0(1) = Request(" LName" )
arFormFields0(2) = " Login"
arFormDBFields0(2) = " Login"
arFormValues0(2) = Request(" Login" )
arFormFields0(3) = " IDRS"
arFormDBFields0(3) = " IDRS"
arFormValues0(3) = Request(" IDRS" )
arFormFields0(4) = " Cubicle"
arFormDBFields0(4) = " Cubicle"
arFormValues0(4) = Request(" Cubicle" )
arFormFields0(5) = " PCBarcode"
arFormDBFields0(5) = " PCBarcode"
arFormValues0(5) = Request(" PCBarcode" )
arFormFields0(6) = " BadgeNum"
arFormDBFields0(6) = " BadgeNum"
arFormValues0(6) = Request(" BadgeNum" )
arFormFields0(7) = " Keycard"
arFormDBFields0(7) = " Keycard"
arFormValues0(7) = Request(" Keycard" )
arFormFields0(8) = " PPSAspect"
arFormDBFields0(8) = " PPSAspect"
arFormValues0(8) = Request(" PPSAspect" )
arFormFields0(9) = " TollFreeAspect"
arFormDBFields0(9) = " TollFreeAspect"
arFormValues0(9) = Request(" TollFreeAspect" )
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0


fp_rs.Update
NewId=fp_rs(0)
FP_DumpError strErrorUrl, " Cannot update the database. A record with that IDRS number already exists in the database."

fp_rs.Close
fp_conn.Close

Session(" FP_SavedFields" )=arFormFields0
Session(" FP_SavedValues" )=arFormValues0
Response.Redirect " confirm.asp"

End If
End If

%>
<%
Dim objMail
Set objMail = Server.CreateObject(" CDONTS.NewMail" )

HTML = HTML & " <HTML>"
HTML = HTML & " <HEAD>"
HTML = HTML & " <TITLE>Send Mail with HTML</TITLE>"
HTML = HTML & " </HEAD>"
HTML = HTML & " <BODY bgcolor=" " lightblue" " >"
HTML = HTML & " <TABLE cellpadding=" " 2" " width=" " 96%" " >"
HTML = HTML & " <TR><FONT color=" " darkblue" " SIZE=" " 4" " >"
HTML = HTML & " Employee data has been submitted. The details are as follows:<BR>"
HTML = HTML & " <BR>Employee' s Name: " & Request.Form(" FName" ) & " " & Request.Form(" LName" )
HTML = HTML & " <BR>IDRS: " & Request.Form(" IDRS" )
HTML = HTML & " <BR>Cubicle: " & Request.Form(" Cubicle" )
HTML = HTML & " <BR>Login: " & Request.Form(" Login" )
HTML = HTML & " </FONT></TR>"
HTML = HTML & " <TR><TD>"
HTML = HTML & " </FONT></TD></TR></TABLE><BR><BR>"
HTML = HTML & " </BODY>"
HTML = HTML & " </HTML>"

objMail.From = " test.com"
objMail.Subject = " Employee Data"

objMail.BodyFormat = 0
objMail.MailFormat = 0
objMail.Importance = 2
objMail.To = " test@test.com"
objMail.Body = HTML
objMail.Send
set objMail = nothing
%>

< Message edited by BeTheBall -- 6/1/2005 9:33:51 >
Spooky

 

Posts: 26722
Joined: 11/11/1998
From: Middle Earth
Status: online

 
RE: Using CDONTS on same page as submission form - 6/19/2003 16:34:30   
Insert the code as below:

Session(" FP_SavedValues" )=arFormValues0 
' --> Here
Response.Redirect " confirm.asp"  


The form variables must exist when posting as well.

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to BeTheBall)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Using CDONTS on same page as submission form - 6/19/2003 16:46:41   
quote:

Insert the code as below:

Session(" FP_SavedValues" )=arFormValues0
' --> Here
Response.Redirect " confirm.asp"


Insert where?

Do you mean

This:

Session(" FP_SavedFields" )=arFormFields0
Session(" FP_SavedValues" )=arFormValues0
' --> Here
Response.Redirect " confirm.asp"


Instead of this:

Session(" FP_SavedFields" )=arFormFields0
Session(" FP_SavedValues" )=arFormValues0
Response.Redirect " confirm.asp"

If so, that didn' t work. :)

(in reply to BeTheBall)
Spooky

 

Posts: 26722
Joined: 11/11/1998
From: Middle Earth
Status: online

 
RE: Using CDONTS on same page as submission form - 6/19/2003 16:53:06   
I mean to insert your email script in that position.
You may need to diet that page as the script will change back.

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to BeTheBall)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Using CDONTS on same page as submission form - 6/20/2003 8:36:03   
Correct as usual King Spooky. Thanks.

(in reply to BeTheBall)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Using CDONTS on same page as submission form
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts