Question

This feels like a very stupid question, but I've been trying and searching for hours and can't figure out the problem. I'm new to pretty much all web development, and this was a test to figure out how to access form data on a new page. It just will not work for me. I have contactus.html and contactusaction.asp saved in the same folder on my desktop. Clicking submit loads contactusaction.asp, but "fname" will not appear on the next page no matter what I try. I've even copy and pasted other people's request.form examples, and I still have yet to get the comand to work in any way.

contactus.html:

<html>
<head>
Hello
</head>
<body>
<form method="post" action="contactusaction.asp"/>


<input type="text" name="fname"/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>

contactusaction.asp:

<html>
<head>Hello:</head>
<body>
<%

Dim x
x=Request.Form("fname")
Response.Write(x)

%>
</body>
</html>
Was it helpful?

Solution

Silly question, but after reading "saved in the same folder on my desktop" I have to ask - are you testing this using IIS or some other web server software on your desktop?

If you're just opening the local HTML page directly (double-clicking on the file vs running a local IIS and going to http://localhost/ or however you have it set up), there's no server running the actual ASP/VBScript code.

Also, reguardless of the answer to the above question, you should definitely fix the <form> tag as Guido Gautier mentions in his comment to your question.

This:

<form method="post" action="contactusaction.asp"/>

Should be this:

<form method="post" action="contactusaction.asp">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top