Is it possible to build a pure HTML register?

Asked

Viewed 374 times

4

I need to create a register with name and description in HTML, or PHP, that does not make use of a database but I do not know if it is possible.

Something that can store the records on file and also upload them back to the form.

The page would contain:

  • Form with the fields Nome and Descrição (field for 200,000 characters minimum)
  • Grid that would list the records, which could be selected for editing
  • Buttons to save, edit, remove and create new record

The idea is to run on a computer without having to install a database system, or something like that. It would run on its own without relying on other programs or installation, running only in the browser.

Any idea how this can be done?

  • 1

    Possible. http://www.html5rocks.com/pt/features/storage

  • Have an example at http://www.html5rocks.com/en/tutorials/webdatabase/todo/? redirect_from_locale=pt

  • Yes, Localstorage (http://www.w3schools.com/html/html5_webstorage.asp), Websql (http://www.tutorialspoint.com/html5/html5_web_sql.htm) and particularly use Html5sql.js (http://html5sql.com/) which is easy to implement.

2 answers

2

Well, you can do this using HTML and PHP, but it would be necessary to handle server-side files, note that: It’s possible, but it’s not very safe since anyone with access to the server could access the entries (unless they’re encrypted).

Come on

First you would need to assemble a common form in HTML, I believe you already know how to do this, in case you don’t know, you can take a look at this link.

The form action should be pointing to your PHP page, in it you should receive all the necessary data via POST or GET.

The structure of the PHP page should look something like:

if(isset($_POST) && !empty($_POST))
{

 <Criação dos campos>;

}

Within this IF structure you will have to carry out the whole process for creating a file in an XML format for reading, this file can be in any formatting you want, that is, you can create tags within it so that it is simpler for you to read the same.

Ex: Pedro Henrique Correia Lorem Ipsum

Then you can record using this tutorial or one of these below:

You can give a name and a write path as you prefer and, to read and fetch the data you want, you can read this here.

Note that if you want to read an encrypted file, first you have to read it as String, and then use simpleXml to turn it into XML

If the system is going to use a large amount of data, I advise you to go adding nodes instead of creating a file for each user or for each record, so when the system is started it can read all documents in an object or an array at a single time, making processing infinitely faster.

0

Another legal way to solve your problem is by using the Local Storage of HTML 5, roughly it is a database contained in the browser, as if it were a cookie that has no expiration date, this means that when closing the browser the data stored in the Local Storage is not lost, it is important to note that the data saved by this feature will not be able to be accessed by other computers through the network, will only work in the browser of the client you own and have saved the application. What is required to use Local Storage? knowledge in HTML and Javascript, follow a link with an example of its use: http://www.devmedia.com.br/trabalhando-com-html5-local-storage-e-json/29045

Browser other questions tagged

You are not signed in. Login or sign up in order to post.