Forum Moderators: open
The actions attached to the submit button are:
OnMouseEvent(Release) {
loadVariablesNum("submit.asp,"0","GET")
}
From what i know, that is all I really need to send the variables to the submit.asp page.
**********
I created a database with DSN "submit"
**********
Here is the code I made for the ASP page:
<%@Language = "VBScript"%>
<%
Option Explicit
Dim rsAdd
Dim connAdd
Dim strName
Dim strAge
Set connAdd = Server.CreateObject("ADODB.Connection")
connAdd.Open "submit"
Set rsAdd = Server.CreateObject("ADODB.Recordset")
strName = Request.Form("name")
strAge = Request.Form("age")
strAdd = "INSERT INTO submit(name, age) VALUES ("&strName&","&strAge&")"
connAdd.execute strAdd
connAdd.close
set connAdd = Nothing
%>
****************
Well, this doesn't work. CAN someone please tell me why???? THANK YOU!
If so, you need the SQL code to look like this (note the ticks, although it's hard to read):
strAdd = "INSERT INTO submit (name, age) VALUES ('" & strName & "'," & strAge & ")"
So strAdd would look like this:
INSERT INTO submit (name, age) VALUES ('joe q public', 31)
Additional Information:
- Yes, i am running from localhost using IIS
- I set up an ODBC for the database
If that still fails, please print out the final sql string that you send (not just the code) and give that to us. Also, please paste the exact error you are getting, to confirm what line of the ASP code is actually failing.
theres some quotes missing "submit.asp"
i'm sure you already knew that and it was a typo, but just in case it wasn't.
<<<<<<<<<<SUBMIT.ASP>>>>>>>>>>>>>>>>>>>>>
<%@Language = "VBScript"%>
<%
Option Explicit
Dim connAdd
Dim strName
Dim strAge
Dim strAdd
strName = Replace(request("name"), "'",""")
strAge = Replace(request("age"), "'",""")
Set connAdd = Server.CreateObject("ADODB.Connection")
connAdd.Open "submit"
strAdd = "INSERT INTO submit(name, age) VALUES ('"&strName&"','"&strAge&"')"
connAdd.execute strAdd
connAdd.close
Set connAdd = Nothing
%>
Check it out if you guys get a chance. Thanks
Thanks
Mark
NOTE: When you are having your ASP page retrieve variables from Flash, you cannot use Request.Form("variable") ...just use
Request("variable").
Here is my new code for anyone interested:
<% Language = "VBScript" %>
<%
Dim conn
Dim rs
Dim query
Set conn = server.createObject("ADODB.Connection")
conn.Open "submit"
Set rs = server.createObject("ADODB.Recordset")
query = "select * from submit"
rs.Open query, conn, 3, 3
rs.addNew
rs("name") = Request("name")
rs("age") = Request("age")
rs.update
rs.close
conn.close
Set rs = Nothing
Set conn = Nothing
%>
Cheers,
Carmo