a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

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

 

3 part form not working

 
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 and Database >> 3 part form not working
Page: [1]
 
rikki

 

Posts: 388
Joined: 4/4/2004
Status: offline

 
3 part form not working - 6/2/2006 22:56:03   
I've got a form that submits to Page 1 - the persion verifies, then submits. The information is then suppose to go to the database and the confirmation (I'll call the confirmation page Page 3)
When i get to the confirmation page I get this error..
Microsoft VBScript compilation error '800a0400'

Expected statement

/campbookings1/Scoutsabout/REGISTRATION/InsertCamp.asp, line 27

END IF
^
It's been a while since I've done this and I"m a little foggy. Any help appreciated..

The code for the insert page is here...
<% 
DIM conntemp, mySQL, myDSN 

myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../fpdb/index.mdb")
'myDSN would be specific to your environment

set conntemp=server.createobject("adodb.connection") 
conntemp.open myDSN 



	mySQL = "INSERT INTO ScoutsAbout"
	mySQL = mySQL & "(Program, FirstName, LastName, Address, City, Province, PostalCode, PhoneNumber, Age, Week)" 		
	mySQL = mySQL & "VALUES("' & Request.Form("Program") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("FirstNameWeek"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("LastName"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("Address"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("City"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("Province"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("PostalCode"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("PhoneNumber"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("Age"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("Week"),"'","''") & "')"

conntemp.execute (mySQL) 

END IF 

NEXT


conntemp.close 
set conntemp=nothing 
Response.redirect("confirmation2.asp?Program="&Request.Form("Program")&"&LastName="&Request.Form("LastName")&"") 
%>
Spooky

 

Posts: 26617
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: 3 part form not working - 6/2/2006 23:08:57   
I would just remove it. It looks left over from some other code?

_____________________________

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

§þ:)


(in reply to rikki)
rikki

 

Posts: 388
Joined: 4/4/2004
Status: offline

 
RE: 3 part form not working - 6/3/2006 22:42:32   
Hi SPooky... worked! I should have saw that!
Now I have another problem. It's telling me my query values and destination fields are not the same. I've checked and double checked and it sure seems to me that they are! Any suggestions?

Thanks

(in reply to Spooky)
BeTheBall

 

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

 
RE: 3 part form not working - 6/4/2006 0:08:17   
Look closely at this line:

mySQL = mySQL & "'" & Replace(Request.Form("FirstNameWeek"),"'","''") & "',"

Guessing it should be FirstName, not FirstNameWeek.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to rikki)
rikki

 

Posts: 388
Joined: 4/4/2004
Status: offline

 
RE: 3 part form not working - 6/4/2006 10:54:37   
Hi Duane...
I caught that after I posted but it didn't change anything..

Sarah

(in reply to BeTheBall)
BeTheBall

 

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

 
RE: 3 part form not working - 6/4/2006 11:24:14   
So before this line:

conntemp.execute (mySQL)

insert:

response.write(mySQL)
response.end

That will show you what the SQL string that is being sent to the server looks like.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to rikki)
rikki

 

Posts: 388
Joined: 4/4/2004
Status: offline

 
RE: 3 part form not working - 6/4/2006 12:50:49   
HI Duane... my values are not getting passed. I've used the request.form to get the values.. then I want the user to verify then click submit.. I've also got it so it will email me..
I'm sure it's the code at the bottom.

Sarah

<%
Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
myMail.BodyFormat = 1
myMail.MailFormat = 1
myMail.From = ""
myMail.To = "sransome@scouts.ca" 
myMail.Subject = "Camp Registration"
myMail.Body = "New Registration for Camp."
myMail.Send
Set myMail = Nothing 
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Please confirm the following information</title>
</head>

<body>

Please confirm the following information and the click on the submit button. 
<br>

<form method="POST" action="InsertCamp.asp">
<%=request.form("Program")%> <br>
<%=request.form("Week")%><br>
<%=request.form("FirstName")%> <%=request.form("LastName")%> <br>
<%=request.form("Address")%><br>
<%=request.form("City")%> <%=request.form("Province")%>  <%=request.form("PostalCode")%><br>
<%=request.form("Age")%>
<%=request.form("PhoneNumber")%>

<p><input type="submit" value="Submit" name="B1"></p>
</form>

</body>
<input type="hidden" name="Program" value="<%=varProgram%>">
<input type="hidden" name="Week" value="<%=varWeek%>">
<input type="hidden" name="FirstName" value="<%=varFirstName%>">
<input type="hidden" name="LastName" value="<%=varLastName%>">
<input type="hidden" name="Address" value="<%=varAddress%>">
<input type="hidden" name="City" value="<%=varCity%>">
<input type="hidden" name="Province" value="<%=varProvince%>">
<input type="hidden" name="PostalCode" value="<%=varPostalCode%>">
<input type="hidden" name="Age" value="<%=varAge%>">
<input type="hidden" name="PhoneNumber" value="<%=varPhoneNumber%>">


</html>


(in reply to BeTheBall)
BeTheBall

 

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

 
RE: 3 part form not working - 6/4/2006 12:59:10   
<input type="hidden" name="Program" value="<%=varProgram%>">

I don't see where you have created varProgram or the other variables you are using as the values in your hidden fields. Probably near the top of the page you should create the variables, i.e.,

varProgram = Replace(Request.Form("Program"),"'","''")

do that for all the variables.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to rikki)
rikki

 

Posts: 388
Joined: 4/4/2004
Status: offline

 
RE: 3 part form not working - 6/4/2006 22:35:52   
Hi Duane...
I got all variables to pass but one... It's the variable called Program.
I've run the response.write and they are all going except that one.. Yet is showing on this page ...
I've reworked this code from something else (that actually you helped me with) so I'm not sure if I got any changes right..
<% 
Dim conntemp, myDSN, myRS, mySQL, varProgram, varWeek, varFirstName, varLastName, varAddress
varProgram = Request.Form("Program") 
varWeek = Request.Form("Week") 
varFirstName = Request.Form("FirstName") 
varLastName = Request.Form("LastName") 
varAddress = Request.Form("Address") 
Set conntemp=Server.CreateObject("ADODB.Connection") 
myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../../fpdb/index.mdb") 
conntemp.open myDSN 
mySQL = "SELECT * FROM ScoutsAbout"
Set myRS = Server.CreateObject("ADODB.Recordset") 
myRS.Open mySQL, conntemp, 0, 1 

%>

<%
Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
myMail.BodyFormat = 1
myMail.MailFormat = 1
myMail.From = ""
myMail.To = "sransome@scouts.ca" 
myMail.Subject = "Camp Registration"
myMail.Body = "New Registration for Camp."
myMail.Send
Set myMail = Nothing 
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Please confirm the following information</title>
</head>

<body>

Please confirm the following information and the click on the submit button. 
<br>
<form method="POST" action="InsertCamp.asp">
<%=varProgram%>
<%=varWeek%>
<%=varFirstName%> <%=varLastName%>
<%=varAddress%>



<input type="hidden" name="Program" value="<%=varProgram%>">
<input type="hidden" name="Week" value="<%=varWeek%>">
<input type="hidden" name="FirstName" value="<%=varFirstName%>">
<input type="hidden" name="LastName" value="<%=varLastName%>">
<input type="hidden" name="Address" value="<%=varAddress%>">



	<p><input type="submit" value="Submit" name="B1">
</form>
</body>


</html>


Here is my SQL for the insert.. I think it's something to do with the 2nd line...???
mySQL = "INSERT INTO ScoutsAbout"
	mySQL = mySQL & "(Program, Week, FirstName, LastName, Address)" 		
	mySQL = mySQL & "VALUES("' & Request.Form("Program") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("Week"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("FirstName"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("LastName"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("Address"),"'","''") & "')"


< Message edited by rikki -- 6/4/2006 22:45:52 >

(in reply to BeTheBall)
Spooky

 

Posts: 26617
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: 3 part form not working - 6/4/2006 23:37:08   
Your second line should be :

mySQL = mySQL & "VALUES('" & Request.Form("Program") & "',"

_____________________________

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

§þ:)


(in reply to rikki)
rikki

 

Posts: 388
Joined: 4/4/2004
Status: offline

 
RE: 3 part form not working - 6/5/2006 4:04:10   
That was it! Thanks...
Now I'm getting this...
Haven't seen it before..
Database Results Error
Description: Command text was not set for the command object.
Number: -2147217908 (0x80040E0C)
Source: Microsoft OLE DB Provider for ODBC Drivers




< Message edited by rikki -- 6/5/2006 12:03:07 >

(in reply to Spooky)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> 3 part form not working
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