-3

maybe this is not the best forum to ask this, as I know this is more intended to specific coding problems. However, i don't know where to ask this question, and if it reveals off topic, i will delete it immediately.

So i am building a website for my parents restaurant, and the front end is currently complete. However, now I want to obtain the users request, the food order, and if possible, send it to my computer or email, so I can create a python script that sends this order to my parents gmail.

Does anyone have a sugestion to solve this problem? Is it necessary to create a sql database?

Thank you for your help.

Rafael Marques
  • 1,335
  • 4
  • 22
  • 35
  • 1
    Welcome to StackOverflow! This question certainly isn't off-topic, though usually quite a lot of prior research is expected here. To store information you **could** use JavaScript and simply log the info to text files, though in order to send E-mails, you would need a back-end script. You'd be **far** better off creating a database, so that you can store information and later **retrieve and manipulate** it :) – Obsidian Age Mar 21 '17 at 21:56

3 Answers3

0

You could use local storage. A new feature of HTML5 which allows you to store information in the browser like cookies. If you do not want the efffort of putting together a database this is a quick easy solution. The following code sample was take from https://www.w3schools.com/html/html5_webstorage.asp where you can find out more on this topic.

// Store
localStorage.setItem("lastname", "Smith");
// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("lastname");

As to email you can retrieve the data from wherever you decide to store it; MySQL, localstorage, direct form input and send it via javascript. There is a good stack article on doing this How to send an email from JavaScript

Community
  • 1
  • 1
Mark Bellamy
  • 135
  • 1
  • 10
0

HTML local storage is intended for relatively small amounts of data; larger than cookies but smaller than most databases for businesses. One big disadvantage of local storage is that it is stored only in the one computer. For your purposes you definitely should use a database, such as MySQL, that exists in the server. You did not specify where the web site exists but I assume you have a hosting company and they probably have MySQL or a similar database.

Unfortunately the way web sites work, JavaScript is usually not used in the server and your database should be in the server. I don't know about use of JavaScript server-side; see Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content | MDN. I can understand that you don't want to learn a new language but you should learn a server-side language such as PHP or C#. If you do all that then the web site will be much more ready to be further improved to do much more.

One thing to consider is whether you want to take payment over the internet. If you do then you will need to make the web site secure. That can require a lot of work if you do it yourself and you know that there are very many experts that get hacked. That is a good reason why you should begin with something like WordPress that has pretty good security built in.  

Sam Hobbs
  • 2,594
  • 3
  • 21
  • 32
-1

You can gather the information from a HTML form and send it via e-mail without a database, but if you want to store the data in a decent manner, then the database is the obvious option.

Nelutu Fona
  • 547
  • 4
  • 11
  • actually, i dont need the information to be stocked "nicely" in a database, because I am only interested in a simple order. Like 3 Pizzas Peperoni and a lasagna. Plus, i dont have stock. I simple need the .txt file generated by the HTML, and send it to me via email. My question is precisely how to do that. – Rafael Marques Mar 21 '17 at 22:11
  • I think you have already made up your mind and don't want help from experts. Experienced people will tell you to save the data server-side. You certainly can do as @NelutuFona describes (send from a form) but then why ask the question if you want to do that? – Sam Hobbs Mar 21 '17 at 22:54