Forum Moderators: open
Tried codefixers code (below)
form.html
<form name="form1" action="add_to_database.asp" method="post">
<div align="center">
<table width="80%" border="0">
<tr>
<td>Name :</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>Email :</td>
<td> <input type="text" name="email"></td>
</tr>
<tr>
<td>Comments :</td>
<td><textarea name="comments"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="submit details" name="submit"></td>
</tr>
</table>
</div>
</form>
and add_to_database.asp
<%@ Language="VBScript" %>
<% Option Explicit %>
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
'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 database
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
connection.Open(sConnString)
'execute the SQL
connection.execute(sSQL)
response.write "The form information was inserted successfully."
'Done. Close the connection object
connection.Close
Set connection = Nothing
%>
</body>
</html>
I just get the error:
Method Not Allowed
The requested method POST is not allowed for the URL /add_to_database.asp.
Please help!
[edited by: jatar_k at 1:18 pm (utc) on Jan. 17, 2007]
[edit reason] no urls thanks [/edit]
IIS Mgr -> Website Properties -> Configuration
On this 'Configuration' page you should be on the 'App Mappings' Tab. The setting for:
.asp C:\WINNT\System32\inetsrv\asp.dll
should be: GET,HEAD,POST,TRACE
Alternatively, I believe there is an 'ALLOW' Header you can put in the response to bypass this.