How do I save the results from an input line to a document in HTML?

59 views Asked by At

How do I save the results of an input line in Html

<form>
<input type="words" name=var>
</form>

In a document such as "webtest.txt" ? This is all of the code I have so far:

<html>
<body>
<script>
</script>
<form>
<input type="words" name=var>
</form>
</body>
</html>

I have this saved in a .html file.

1

There are 1 answers

2
SergioAMG On BEST ANSWER

First:

You will need to use a back-end programming language for handling the file I/O. Examples: PHP, .NET, Pyhton, Java and more.

Next:

You will need to perform a POST/GET operation to the back-end code. You will sent your data from the UI layer (HTML) to the back-end for its processing and then , the back-end will send you a Response back. At this point you will need to use you selected language to build some code that receives the parameter "var" and creates a file in the server called "webtest.txt" with the received data.

Then:

You catch the result of the operation at HTML layer and shows the user if the value was or was not saved into the file.

You can build this solution as robust as you need.