View Full Version : updating multiple items on a web page
07-20-2011, 04:27 AM
I am fairly new to HTML, and am getting stuck with simple concepts that work in non web-based code. Hopefully what I am looking to do is simple, but it seems HTML lacks this functionality (for security reasons).
Lets say I have 3 different kinds of cookies on a web site, each has multiple locations. One of the cookies changes its name from banana nut to nutmeg. Is there an easy way to input that information in one place and have it updated in all pertinent locations?
I have looked in posts up to 10 pages back and have not seen any that touch on this topic. Any help offered would be greatly appreciated.
07-20-2011, 04:59 AM
I had to read this a couple times, because "updating a cookie" has meaning in the web space beyond what I think you mean. If you're talking about cookies from a bakery, then the typical way you'd change their names is to have all the cookie information in a database, and any page that needed information about them would pull it from the database. Then one change in the database would affect all relevant pages.
So this would be a server-side function, using PHP or ASP, and a database.
07-20-2011, 05:34 AM
07-20-2011, 08:46 AM
What you want to do is not possible with HTML only, there are following ways to do same:
2. If your data is huge, then you have to use database only.
07-20-2011, 02:48 PM
One thing you will need to realize early on, is the limitations strict html has. One being that html alone cannot store, pass, or manipulate data.
Now, perhaps, if I'm understanding your issue correctly, you could use includes to "change" data in multiple locations. You would need to use a server side language to do this though, but its really a very simple process.
If you have a common page element, say for example a header, that is the same on all pages in your site. You could separate this code from all pages and place in a separate file. Then with one line( an include) you can include this whole code block in every page that has the include statement. The advantage to this is that you can edit that separated file as much as you like, and this would be reflected in every instance where its used. Before I go further, make sure this might be something you could use.
07-20-2011, 03:42 PM
@tracknut... i got so confused as to the whole cookie naming thing until I read your post as well lol
I agree with what pretty much everyone is saying... i wanted to throw into the mix... and for anyone readin, this is "not how I roll" you may want to consider an access database... I do not generally recommend this (as some of my work entails going through and fixing ppl who have decided to go this route) but if you are a small business and only you will be using then go for it... EVERYTHING is wizards... you make "sql" statements using wizards, you format your tables using wizards... you can make macros (again using wizards) and then click a fun little button that converts it to VB... for the person who doesn't want to learn database stuff, it works... some things to keep in mind
there is only 2G of database space
only one user can access the database at a time
Again- i do not generally recommend this solution, but i think in your case it is a viable solution
07-20-2011, 04:05 PM
The data is simply from research, and needs to be updated occasionally. It is a lot easier for me to update the data in one location (or add new data points) than it is to go to every single point the data is entered on the several HTML pages that it exists.
I suppose that does bring out one more question from me though. How would this method work security-wise? I do not want someone being able to hack into the site and alter the data values that have been entered into the java class. It is not finished yet, but here is an example of how I used it.
/*in the HTML file*/
The class itself is defined in Variables.js, and holds all the values that I need stored. In the specific location on whatever page the data happens to reside, I should just be able to include a document.write function to put that data into a DIV element (havent quite gotten that far yet).
Is this a fairly secure method or should I try to learn databases?
07-20-2011, 04:22 PM
Again, this can be done with server side scripts just as easy, and will not matter what the user chooses to turn on or off in their browsers, it will just work.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.