Forum Moderators: open
This time I am already building a visitor counter which I could share with my users. I tried to google for any tutorial of JavaScript saving variables in database. Or a PHP file co-operating with JavaScript.
Idea is a simple visitor counter. Every time the script is called (page view) it performs this: Existing count + 1. Then it saves it to the database where id is same as the id given in the address of the script. After all that is done, it would display the count in numbers at the page the script was called from.
I think I would need to mix JavaScript and PHP, but I'm truly hopeles in JavaScript ;)
Or, you could always run a server side Java applet, which then writes to disk.
Bottom line -- you cannot do this with JavaScript alone. You will need a server side language to handle writing to a file/database/whatever.
If this is a remotely hosted script, then I guess you need it on your end (which means everyone writes stuff to your server).
I think I have came up with an idea which would shift the variable stored in database for javascript to use. I thought of adding a hidden textbox, which will have the value of the value found in the database. Javascript would then read the value of that field and print it on the screen.