How to process html form data in vbscript

I'm trying to take input from html input boxes and insert the data into a access database.

The vbscript when executing it independently updates the database when i have hard coded values in it.

I'm trying to change it from static hard coded values to use the data input from an html form,
but I haven't been able to do it.

I tried changing these hard code values
objRecordSet("Name") = "vbscript"
objRecordSet("Comments") = "updateMe"

To
objRecordSet("Name") =  Request.Form("name")
objRecordSet("Comments") = Request.Form("comments")

but i get an error 'Object required: 'Request'

from what i can tell by googling i'm trying to put server side code in a client side application
and i can't use Request.Form()

Is there a way for a vbscript to use the post data of an html form?
Attached is the code for my 2 files

File updateDB.html----------------------------------
 
<html>
<head>
<title>Guestbook Form</title>
</head>
<body bgcolor="white" text="black">
<!-- Begin form code -->
<form name="form" method="post" action="add_new_record.vbs">
  Name: <input type="text" name="name" maxlength="20">  
  <br>
  Comments: <input type="text" name="comments" maxlength="60">
  <input type="submit" name="Submit" value="Submit">
</form>
<!-- End form code -->
</body>
</html>
 
File add_new_record.vbs----------------------------------
Const adOpenStatic = 3
Const adLockOptimistic = 3
 
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
 
objConnection.Open _
    "Provider = Microsoft.ACE.OLEDB.12.0; " & _
        "Data Source = guestbook.accdb" 
 
objRecordSet.Open "SELECT * FROM tblComments" , _
    objConnection, adOpenStatic, adLockOptimistic
 
objRecordSet.AddNew
objRecordSet("Name") = Request.Form("name")
objRecordSet("Comments") = Request.Form("comments")
objRecordSet.Update
 
objRecordSet.Close
objConnection.Close

Open in new window

mitchguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
>>action="add_new_record.vbs"
rename the file to asp and update your action:
action="add_new_record.asp"

request is an IIS Server Object so you need to submit to a server script (asp).
0
mitchguyAuthor Commented:
Well i didn't get the error, but the database didn't update either, it's as if
the Request.Form() call worked, but there was no data

Do you see anything i'm missing?
0
hieloCommented:
Did you enclose the code in asp tags? Below is the COMPLETE file:
<%@language="vbscript"%>
<%
'File add_new_record.vbs----------------------------------
Const adOpenStatic = 3
Const adLockOptimistic = 3
 
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
 
objConnection.Open _
    "Provider = Microsoft.ACE.OLEDB.12.0; " & _
        "Data Source = guestbook.accdb" 
 
objRecordSet.Open "SELECT * FROM tblComments" , _
    objConnection, adOpenStatic, adLockOptimistic
 
objRecordSet.AddNew
objRecordSet("Name") = Request.Form("name")
objRecordSet("Comments") = Request.Form("comments")
objRecordSet.Update
 
objRecordSet.Close
objConnection.Close
%>

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

hieloCommented:
Also, you don't need SELECT to add a new query
<%
'File add_new_record.vbs----------------------------------
Const adOpenStatic = 3
Const adLockOptimistic = 3
 
Set objConnection = CreateObject("ADODB.Connection")
 
 
objConnection.Open _
    "Provider = Microsoft.ACE.OLEDB.12.0; " & _
        "Data Source = guestbook.accdb" 
 
objConnection.Execute "INSERT INTO [tblComments]( [Name],[Comments] ) VALUES( '" & Replace(Request.Form("name"),"'","''") & "','" & Replace(Request.Form("comments"),"'","''") & "'"
objConnection.Close
Set objConnection=Nothing
%>

Open in new window

0
mitchguyAuthor Commented:
Still can't get it to work.
You dont happen to have access 2007 do you?
The database is very basic.
It's created with access 2007 and as you can tell from the code named guestbook.accdb
and has one table named "tblComments" which has 3 fields
ID_no (AutoNumber)
Name(Text)
Comments(Text)

Is there an easy way to print to the screen from the asp file what values it's getting from the html page?
I don't know if this matters or not, but after clicking the submit button on the html page the asp page is then displayed in the browser. I'm not sure if that is supposed to happen or not?
0
hieloCommented:
>>after clicking the submit button on the html page the asp page is then displayed in the browser
Oh no! It sounds like you are NOT serving your html page from an IIS server. If I am not mistaken, you intend to put that page online. If so, you need to install IIS and run it from IIS.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mitchguyAuthor Commented:
Is IIS the only server that this would work with?  i have apache server installed
0
mitchguyAuthor Commented:
looks like i have IIS 5.1 installed already as well.
I will see what i can figure out
0
hieloCommented:
>>looks like i have IIS 5.1 installed already as well.
Good.
0
mitchguyAuthor Commented:
Is there a particular folder structure that must be in order for this to work?

I have the folder with the files in it in the wwwroot folder, but it still
just displays the code in the browser when i try running it
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.