Reputation: 6845
I've been tasked with making a webpage in ONLY HTML. I am at the point where I want to create forms. However, I'm not sure if these form submissions can be saved using only HTML.
I applied the following code (obtained from WC3 Schools) to my webpage:
<form name="input" action="html_form_action.asp" method="get">
Username: <input type="text" name="user" />
<input type="submit" value="Submit" />
</form>
I created a filed called "html_form_action.asp". However, when I double click my .html file to launch my page and I click submit (to submit the form), I receive an error "page can't be loaded" and nothing is written to my html_form_action.asp file. Is there some other way I'm supposed to set this up?
Thank You for any help! :)
Upvotes: 0
Views: 984
Reputation: 1317
Sounds like you are trying to access your .asp file from the file system, but in order for anything to happen that file needs to be behind a web server.
Not sure if you have one set up, but that's the only way you will get a response to the post request. (i.e. when you hit submit)
Also: be sure that if you have a relative path to your .asp file that it points to the right place ( or that your html file is in the right directory - for your code snippet, that means the same directory )
Upvotes: 1
Reputation: 945
You need to set up a web server to process your requests on the back end! There is need to have javascript as you said! Because you seem to be using ASP, setting up Microsoft IIS on your computer would be a good option.
Double clicking the HTML file will not help. You need to run it via your set up server then.
Upvotes: 1
Reputation: 5023
Well, you cannot double click you html file since it would be loaded in browser as local files. The asp
files need to be host in a web server (e.g., IIS).
Upvotes: 1