form post using asp

by seyiisq - 6/12/13 3:04 AM

Hi all,

I have a formas shown below

<title>Form to Database</title>
<!-- comment - start the HTML form and
use a HTML table for formatting-->
<form name="form1" action="add_to_database.asp" method="post">
<div align="center">
<table width="80%" border="0">
<td>Name :</td>
<td><input type="text" name="name"></td>
<td>Email :</td>
<td> <input type="text" name="email"></td>
<td>Comments :</td>
<td><textarea name="comments"></textarea></td>
<td><input type="submit" value="submit
details" name="submit"></td>
<!-- end the HTML form-->

using asp named add_to_database.asp as shown below

<%@ Language="VBScript" %>
<% Option Explicit %>
<title>Form to database</title>
'declare your variables
Dim name, email, comments
Dim sConnString, connection, sSQL
'Receiving values
from Form, assign the values entered to variables
name = Request.Form("name")
email = Request.Form("email")
comments =Request.Form("comments")

'declare SQL statement that will query the
sSQL = "INSERT into users_tbl (name, email, comments) values
('" & _
name & "', '" & email & "', '"
& comments & "')"
'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("Users.mdb")

'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Open the connection to the database

'execute the SQL

response.write "The form information was inserted successfully."
'Done. Close the connection object
Set connection = Nothing

i also created a database called users.mdb

Each time i click the submit button, it does not post to the database, it only load the asp page.

Please can any one advice