scottbacca
Technical User
Hi,
This is my first go at writing scripts.i want to capture data entered on a form and write it to an access database. I know this subject has been covered previously but i'm still a little confused so any help would be very much appreciated.
OK, heres the situation.
I have created a form in dreamweaver - 2 textboxes (Name and IDand 5x5 groups of radiobuttons. At the moment i'm just seeing if what i enter in the textboxes will be written to an access db table named "table".
In the form header i have the following:
<form method="post" action="submissions.asp">
form layout
<input type='submit' value='Submit'> (at the end)
</form>
The script in my submissions.asp file looks like this:
<%@ Language="VBScript" %>
<% Option Explicit %>
<%
Dim Name, ID, sql, conn, cmAdd
Name = Request.Form("Name"
ID = Request.Form("ID"
sql = "INSERT INTO Table (Name, ID ) VALUES ('"& Name & "', '" & ID & "' );"
'connection
Set conn = Server.CreateObject("ADODB.Connection"
conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=p:\st_proto\footy\footy.mdb"
conn.Open
set cmAdd = Server.CreateObject("ADODB.Command"
set cmAdd.ActiveConnection = conn
cmAdd.CommandText = sql
cmAdd.Execute
conn.Execute(sql)
conn.Close
Set conn = nothing
response.redirect("thanks.html"
%>
My problems are:
1. When i hit the "submit" button to submit the form info, a box comes up telling me i'm about to download submissions.asp and do i want to "save it to disk" or "open from its current location".
My questions are: (and there are so many)
1. Is there anyting wrong with my code?
2. i'm not currently running a web server, do i need to?
3. do i need to have my database in a special place?
ANy help would be fantastic.
Scott
This is my first go at writing scripts.i want to capture data entered on a form and write it to an access database. I know this subject has been covered previously but i'm still a little confused so any help would be very much appreciated.
OK, heres the situation.
I have created a form in dreamweaver - 2 textboxes (Name and IDand 5x5 groups of radiobuttons. At the moment i'm just seeing if what i enter in the textboxes will be written to an access db table named "table".
In the form header i have the following:
<form method="post" action="submissions.asp">
form layout
<input type='submit' value='Submit'> (at the end)
</form>
The script in my submissions.asp file looks like this:
<%@ Language="VBScript" %>
<% Option Explicit %>
<%
Dim Name, ID, sql, conn, cmAdd
Name = Request.Form("Name"
ID = Request.Form("ID"
sql = "INSERT INTO Table (Name, ID ) VALUES ('"& Name & "', '" & ID & "' );"
'connection
Set conn = Server.CreateObject("ADODB.Connection"
conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=p:\st_proto\footy\footy.mdb"
conn.Open
set cmAdd = Server.CreateObject("ADODB.Command"
set cmAdd.ActiveConnection = conn
cmAdd.CommandText = sql
cmAdd.Execute
conn.Execute(sql)
conn.Close
Set conn = nothing
response.redirect("thanks.html"
%>
My problems are:
1. When i hit the "submit" button to submit the form info, a box comes up telling me i'm about to download submissions.asp and do i want to "save it to disk" or "open from its current location".
My questions are: (and there are so many)
1. Is there anyting wrong with my code?
2. i'm not currently running a web server, do i need to?
3. do i need to have my database in a special place?
ANy help would be fantastic.
Scott