Getting user input and storing it

Getting user input and storing it
0

#1

Hello, I’ve been learning web development for a few months now. Today doing a project I realized I’m missing some very basic knowledge on how to do something so simple. I’ve been learning through various resources but non tackles how to store, where and how, whatever an user puts in a contact for for example. How do you guys handle this?

As far as I can guess, I would store the user input using javascript, and then maybe have it send that input to my e-mail somehow? What if I want to create a text file or something else instead of an e-mail. I would appreciate any help or ideas.


#2

You don’t need any javascript to send to email: HTML send form to email

Text file would be more complicated, and depends on if you want that text to be server-side or client-side.

If you only really want to be able to recall the values with more JS then:
Storing on client: Use localStorage
Storing on the server: Send to the server and save it somewhere where you can get to it later, and how you do that all depends on your implementation.


#3

One question is “store and do what with it later?” If you want the user to be able to access their stored data, then of course it won’t do any good in your email. But, for relatively small purposes, localStorage and sessionStorage are pretty great. Obviously not as permanent as a system that involves a user logging in and having an account (the user can wipe out this storage by clearing the browser cache), but nice and easy to implement. See also http://www.w3schools.com/html/html5_webstorage.asp, and the important footnote that everything is stored as a string.


#4

Thanks for the information.