Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple ASP page not working

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

I'm trying to do an online survey via our intranet and get the results to dump into an Access database. I've never done this before.

In trying to do a simple tutorial I found on a website, something is happening I don't understand.

It is a simple form with name, age, and gender. When I click submit, the data is supposed to be put in the database using an ASP script that I created. Instead, when I click submit, it tells me that it is downloading the ASP page. Why is this happening? The code is below.

Web Page:

<form name=&quot;myform&quot; method=&quot;post&quot; action=&quot;post_db.asp&quot;>
Firstname:<br>
<input name=&quot;firstname&quot; type=&quot;text&quot; maxlength=&quot;25&quot;>
Lastname:<br>
<input name=&quot;lastname&quot; type=&quot;text&quot; maxlength=&quot;25&quot;>
Age:<br>
<input name=&quot;age&quot; type=&quot;text&quot; maxlength=&quot;3&quot;>
Gender:<br>
<input name=&quot;gender&quot; type=&quot;text&quot; maxlength=&quot;6&quot;>

<input type=&quot;submit&quot; value=&quot;submit&quot; name=&quot;s_button&quot;>
<input type=&quot;reset&quot; value=&quot;reset&quot; name=&quot;r_button&quot;>

</form>

ASP Script

<%

'variables
dim Conn, Connstring, Sql
strfirstname=request.form(&quot;firstname&quot;)
strlastname=request.form(&quot;lastname&quot;)
strage=request.form(&quot;age&quot;)
strgender=request.form(&quot;gender&quot;)

'database connection
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
ConnString = &quot;DBQ=&quot; & Server.MapPath(&quot;database.mdb&quot;)
Conn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)}; &quot; & ConnString

'Sql statement
Sql=&quot;INSERT INTO mytable (name, url, message) VALUES ('&quot; & strfirstname & &quot;','&quot; & strlastname & &quot;','&quot; & strage & &quot;','&quot; & strgender & &quot;')&quot;
Conn.Execute(Sql)

%>
 
this sounds like a IIS issue. Is that how you are testing etc.. IIS
The code looks fine to me. but like I said it sounds like a server side problem. The way you explained it is what would happen if you were not running the page thru IIS or something simular. A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
onpnt is right I think.
When the browser is trying to download the web page is because there is no IIS or PWS executing the asp code.

Where is your page saved? If you are using your computer (win98, win me, for example) you should have installed the PWS and test the page using htt://127.0.0.1/yourTestPage.asp
If you try to call it from a hard disk like c:\someFolder\yourTestPage.asp you'll get the kind of problem you described.

Hope this is useful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top