OutFront Forums
     Home    Register     Search      Help      Login    

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

Sponsors
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.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

Form not passing values

 
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 >> Form not passing values
Page: [1]
 
rikki

 

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

 
Form not passing values - 8/31/2009 21:38:20   
I've got the following code - i've modified it from the something else but it's not passing the EquipNameID Value
These are the values that are being passed
INSERT INTO Equip2(BookingNumber, StaffID, EquipDate1, EquipDate2, Details, DateBooked, EquipNameID, ItemReturned)
VALUES(0,3,#2/11/2010#,#2/12/2010#,'details',#8/31/2009#,'','No')

Any ideas??

<!-- #include virtual="\Equipment1\spookyEquip\spooky_protection_accesslev.inc" -->
<% 
Dim conntemp, myDSN, myRS, mySQL, varEquipDate1, varEquipDate2, arrEquipNameID
varEquipDate1 = Request.Form("EquipDate1") 
varEquipDate2 = Request.Form("EquipDate2") 
Set conntemp=Server.CreateObject("ADODB.Connection") 
myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/Equipment1/fpdb/Equipment.mdb") 
conntemp.open myDSN 
mySQL = "SELECT EquipNameID FROM Equip2 WHERE ((#"&varEquipDate1&"# Between EquipDate1 And EquipDate2) OR (#"&varEquipDate1&"# Between EquipDate1 And EquipDate2))"
Set myRS = Server.CreateObject("ADODB.Recordset") 
myRS.Open mySQL, conntemp, 0, 1
If myRS.eof OR myRS.bof then 
RecordFound=0 
Else 
arrEquipNameID = myRS.GetString(,,,"<br>") 
RecordFound=-1 
End if 
myRS.Close 
Set myRS = nothing 
conntemp.Close 
Set conntemp = nothing 
%> 
<html>

<head>



<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Equipment</title>
<meta name="Microsoft Theme" content="tabs 1111">
</head>

<body> 
<% 
If RecordFound <> 0 then 
Response.Write ("") 
else 
Response.Write(arrEquipNameID) 
End if 
%> 

<p>

</p>
 <form method="POST" action="4InsertEquip.asp">
   <div align="left"> 
                  Equipment Booking</div>
	<div align="left"> 
                   </div>
   <div align="left"> 
                  <font size="1">
                  <input type="text" name="EquipDate11" size="20" value="<%=varEquipDate1%>" disabled> 
                  (to change these dates click the back button on your browser)</div>
<input type="text" name="EquipDate21" size="20" value="<%=varEquipDate2%>" disabled> <br>
   <br>
     

   </font><font size="4">Please select the equipment you would like to book</font><font size="1"><br>
     </font><br>
        <input type="checkbox" name="EquipNameID1" value="PullUpDisplay" <%If Instr(arrEquipNameID,"PullUpDisplay") Then Response.Write("disabled")End IF%>> 
	Pull Up Display Unit #1 <br>
 <input type="checkbox" name="EquipNameID2" value="Shelter" <%If Instr(arrEquipNameID,"Shelter") Then Response.Write("disabled")End IF%>> 
   Shelter (10x10)<br>
 <input type="checkbox" name="EquipNameID3" value="Projector" <%If Instr(arrEquipNameID,"Projector") Then Response.Write("disabled")End IF%>> 
	LCD Projector<br>
 <input type="checkbox" name="EquipNameID4" value="SoundSystem" <%If Instr(arrEquipNameID,"SoundSystem") Then Response.Write("disabled")End IF%>> 
   Sound System<br>
 <input type="checkbox" name="EquipNameID5" value="PopcornMachine" <%If Instr(arrEquipNameID,"PopcornMachine") Then Response.Write("disabled")End IF%>> 
   Popcorn Machine<br>
 <input type="checkbox" name="EquipNameID6" value="WolfMascot" <%If Instr(arrEquipNameID,"WolfMascot") Then Response.Write("disabled")End IF%>> 
   Wolf Mascot<br>
   <b><font size="1">
   
   <br>
  

 
<br>

 
</font>Booked by: 
	<font size="1">
   
   <font size="3"><select size="1" name="StaffID">
	<option>Select a name</option>
	<option value="3">Elizabeth Barrow</option>
	<option value="9">Kim McLaughlin</option>
	<option value="1">Sarah Ransome</option>
	<option value="2">Lorne Ellis</option>
	<option value="11">Debbie Maw</option>
	<option value="10">John Galloway</option>
	<option value="6">David Stokes</option>
	<option value="5">Fran Carriere</option>
	<option value="4">Amy Pinsonneault</option>
	<option value="7">Grant Ferron</option>
	<option value="8">Cheryl Fitcyk</option>
	</select></font> 
	<br>
	<br>

</font>Details<font size="1"><br>
	</font></b><input type="text" name="Details" size="150"><p>
	<b>Date Booked: <input type="text" name="DateBooked" value="<%=Date()%>" size="20"><p>
	
	<input type="submit" value="Submit" name="Submit" onclick="return checkcheckboxes(this.form)"></p>
   <input type="hidden" name="EquipDate1" value="<%=varEquipDate1%>">
	<input type="hidden" name="EquipDate2" value="<%=varEquipDate2%>">

	<input type="hidden" name="BookingNumber" value="0">
	<input type="hidden" name="ItemReturned" value="No">
	
	<td> 



</form>


 
</body>

</html>
Spooky

 

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

 
RE: Form not passing values - 9/1/2009 3:33:52   
Where is your insert code? All I see here is the form that passes the info?

_____________________________

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

Sp:)ky


(in reply to rikki)
rikki

 

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

 
RE: Form not passing values - 9/16/2009 21:23:52   
Here is the insert code

<!-- #include virtual="\Equipment1\spookyEquip\spooky_protection_accesslev.inc" -->
<% 
DIM conntemp, mySQL, myDSN 

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

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


FOR i = 1 to 6
	IF Request("EquipNameID" & i) <> "" THEN 

	mySQL = "INSERT INTO Equip2"
	mySQL = mySQL & "(BookingNumber, StaffID, EquipDate1, EquipDate2, Details, DateBooked, EquipNameID, ItemReturned)" 		
	mySQL = mySQL & "VALUES(" & Request.Form("BookingNumber") & ","
	mySQL = mySQL & "" & Request.Form("StaffID") & ","
	mySQL = mySQL & "#" & Request.Form("EquipDate1") & "#,"
	mySQL = mySQL & "#" & Request.Form("EquipDate2") & "#,"
	mySQL = mySQL & "'" & Replace(Request.Form("Details"),"'","''") & "',"
	mySQL = mySQL & "#" & Request.Form("DateBooked") & "#,"
	mySQL = mySQL & "'" & Replace(Request.Form("EquipNameID"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("ItemReturned"),"'","''") & "')"

response.write mySQL
response.end
conntemp.execute (mySQL) 

END IF 

NEXT


conntemp.close 
set conntemp=nothing 
Response.redirect "Listing7.asp"
%>

(in reply to Spooky)
BeTheBall

 

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

 
RE: Form not passing values - 9/20/2009 16:57:11   
May I suggest you change your approach just a bit? First, on your submit form, you have EquipNameID1, EquipNameID2, etc. I suggest you name all 6 checkboxes EquipNameID. When you do this, the code will send a comma-delimited string of the values of each checked box to the next page.

Then, in your code that inserts the record, change this:

FOR i = 1 to 6
	IF Request("EquipNameID" & i) <> "" THEN 

	mySQL = "INSERT INTO Equip2"
	mySQL = mySQL & "(BookingNumber, StaffID, EquipDate1, EquipDate2, Details, DateBooked, EquipNameID, ItemReturned)" 		
	mySQL = mySQL & "VALUES(" & Request.Form("BookingNumber") & ","
	mySQL = mySQL & "" & Request.Form("StaffID") & ","
	mySQL = mySQL & "#" & Request.Form("EquipDate1") & "#,"
	mySQL = mySQL & "#" & Request.Form("EquipDate2") & "#,"
	mySQL = mySQL & "'" & Replace(Request.Form("Details"),"'","''") & "',"
	mySQL = mySQL & "#" & Request.Form("DateBooked") & "#,"
	mySQL = mySQL & "'" & Replace(Request.Form("EquipNameID"),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("ItemReturned"),"'","''") & "')"

response.write mySQL
response.end
conntemp.execute (mySQL) 

END IF 

NEXT


to this:

myArray = Split(Request.Form("EquipNameID"),",")
FOR i = 1 to myArray.length
	mySQL = "INSERT INTO Equip2"
	mySQL = mySQL & "(BookingNumber, StaffID, EquipDate1, EquipDate2, Details, DateBooked, EquipNameID, ItemReturned)" 		
	mySQL = mySQL & "VALUES(" & Request.Form("BookingNumber") & ","
	mySQL = mySQL & "" & Request.Form("StaffID") & ","
	mySQL = mySQL & "#" & Request.Form("EquipDate1") & "#,"
	mySQL = mySQL & "#" & Request.Form("EquipDate2") & "#,"
	mySQL = mySQL & "'" & Replace(Request.Form("Details"),"'","''") & "',"
	mySQL = mySQL & "#" & Request.Form("DateBooked") & "#,"
	mySQL = mySQL & "'" & Replace(myArray(i),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("ItemReturned"),"'","''") & "')"
conntemp.execute (mySQL) 
NEXT


I think this will get what you are after.

_____________________________

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: 395
Joined: 4/4/2004
Status: offline

 
RE: Form not passing values - 9/23/2009 10:48:17   
Duane
This is the error... Microsoft VBScript runtime error '800a01a8'

Object required: 'myArray'

/Equipment1/4InsertEquip.asp, line 12

The insert code looks like this -
<!-- #include virtual="\Equipment1\spookyEquip\spooky_protection_accesslev.inc" -->
<% 
DIM conntemp, mySQL, myDSN 

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

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

myArray = Split(Request.Form("EquipNameID"),",")
FOR i = 1 to myArray.length
	mySQL = "INSERT INTO Equip2"
	mySQL = mySQL & "(BookingNumber, StaffID, EquipDate1, EquipDate2, Details, DateBooked, EquipNameID, ItemReturned)" 		
	mySQL = mySQL & "VALUES(" & Request.Form("BookingNumber") & ","
	mySQL = mySQL & "" & Request.Form("StaffID") & ","
	mySQL = mySQL & "#" & Request.Form("EquipDate1") & "#,"
	mySQL = mySQL & "#" & Request.Form("EquipDate2") & "#,"
	mySQL = mySQL & "'" & Replace(Request.Form("Details"),"'","''") & "',"
	mySQL = mySQL & "#" & Request.Form("DateBooked") & "#,"
	mySQL = mySQL & "'" & Replace(myArray(i),"'","''") & "',"
	mySQL = mySQL & "'" & Replace(Request.Form("ItemReturned"),"'","''") & "')"


conntemp.execute (mySQL) 
NEXT



conntemp.close 
set conntemp=nothing 
Response.redirect "Listing7.asp"
%>

(in reply to BeTheBall)
BeTheBall

 

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

 
RE: Form not passing values - 9/23/2009 19:03:03   
One thing you will need to fix. This:

FOR i = 1 to myArray.length

should be:

FOR i = 0 to myArray.length

Not sure if that is what is causing the error. Let me know if it isn't.

_____________________________

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: 395
Joined: 4/4/2004
Status: offline

 
RE: Form not passing values - 9/23/2009 19:09:08   
Made change - didn't fix - Same error

(in reply to BeTheBall)
BeTheBall

 

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

 
RE: Form not passing values - 9/23/2009 22:45:39   
Whoa! Way too much C# and javascript for me lately. Try changing this:

FOR i = 0 to myArray.length

to

FOR i = 0 to Ubound(myArray)

_____________________________

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: 395
Joined: 4/4/2004
Status: offline

 
RE: Form not passing values - 9/24/2009 12:09:02   
We're almost there - this is the error..


Microsoft VBScript compilation error '800a03f2'

Expected identifier

/Equipment1/4InsertEquip.asp, line 12

FOR i = 0 to Ubound.(myArray)
--------------------^

(in reply to BeTheBall)
BeTheBall

 

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

 
RE: Form not passing values - 9/24/2009 12:29:32   
Is that a dot between Ubound and (myArray)? If so, it shouldn't be there.

_____________________________

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: 395
Joined: 4/4/2004
Status: offline

 
RE: Form not passing values - 9/24/2009 14:44:46   
I actually caught that - but still getting error
Microsoft JET Database Engine error '80004005'

Operation must use an updateable query.

/Equipment1/4InsertEquip.asp, line 24

I did a response.write and all the values seem to passing.
INSERT INTO Equip2(BookingNumber, StaffID, EquipDate1, EquipDate2, Details, DateBooked, EquipNameID, ItemReturned)VALUES(0,9,#11/22/2009#,#11/22/2009#,'test',#9/24/2009#,'PullUpDisplay','No')

(in reply to BeTheBall)
BeTheBall

 

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

 
RE: Form not passing values - 9/24/2009 16:38:27   
What is the primary key (unique ID) in the Equip2 table? It isn't "BookingNumber" is it? If it is, then remove BookingNumber and its corresponding value from the INSERT SQL.

_____________________________

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: 395
Joined: 4/4/2004
Status: offline

 
RE: Form not passing values - 9/24/2009 19:33:47   
Working for now as I moved the database files to another working database. There seems to be some permission problems with that one.
It's working fine..
Thanks



(in reply to BeTheBall)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Form not passing values
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