Y
Y
Yaroslav Nikitin2015-01-18 00:09:18
PHP
Yaroslav Nikitin, 2015-01-18 00:09:18

How and where is it better to store the code for a while?

I am writing a website related to HTML and CSS lessons. Lessons have tasks to complete.
Problem : the written code will disappear after reloading the page.
Question: how best to autosave the code and where to store all this code?
I'm going to keep the code for a day, more is not needed. I have only three options for where to store, maybe you can suggest something else. The first option is to store in cookies, the second option in the database, the third in files. The first option is in the database: here the question arises, is the load on the database too heavy? After all, overwriting can be very multiple over a short period of time. It will be necessary to send data by Ajax, there are no problems with this. With cookies, I think it's easier and more efficient, maybe I'm wrong, but so far there are no thoughts on how to put code into cookies. And the last option is to store in files, while there are only problems with how to delete them later in a day, of course, there are thoughts.
A little about the system: The code is in the textarea in a certain form (spaces, tabs and hyphens are replaced by the escape sequences \n, \t), in short, all the manipulations will need to be done with the textarea and without reloading the page.
I hope to get your opinion on where it is more profitable to store.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
IceJOKER, 2015-01-18
@copyloc

localStorage maybe?

I
index0h, 2015-01-18
@index0h

sessionStorage, When the page is closed, the data should disappear?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question