I am a college student slightly new to web programming and lately I have “ran into a wall” so to speak.
It is hard to explain my problem, since I do not understand everything that is going on, but a friend referred me to this website and I hope that the guidance here will set me in the right direction.
This is what I am trying to do: Create an inventory that can be accessed via a webpage through multiple computers, and can be edited by every user.
What I have already done: I have created the HTML page and added Javascript. The Javascript interacts with quantities of items in inventory, and the user can change the amount of a certain item as they withdraw an item or add an item. But, when the page reloads, the numbers return to their default value of zero.
I have researched into editing cookies through Javascript, but that only works for a single computer. Same problem with “window.name”. I have looked slightly into databases, then shuddered and closed the door quickly. If a database is the only option, then can someone please point me toward a beginner’s tutorial of databases?
From my viewpoint, the main problem I have is modifying a variable in Javascript on a webpage, then somehow saving that variable to a document in ONE location. This way every computer connected to that network can access the variables and modify them as needed.
I would appreciate any help on this matter!
That, my friend, is a database. Yes, a database is the solution. What you need to understand first about web development is that there are two kinds: client side and server side. Javascript is client side development, meaning it works on the user’s browser. You have a variable on the client side, but only that client can see it. Server side is different. It exists on the server alone. Your server “serves” your page (and any content from a database or whatever) to the client. Therefore any changes on the server will be visible to all the clients (what you want). To program server side, you have to use another language other than javascript (you can use node.js but that’s entirely different than client side javascript). Other languages include PHP, Java, C#, etc.
Therefore, you need to look up server side scripting.