I am trying to make it possible for users to vote on some of my pictures online.
I am writing all my code in HTML, JavaScript and PHP.
When the user presses the vote button, it counts 1 up. Then when the user refreshes the page, I want to keep the vote, so it will still say 1, instead of resetting to zero.
My question is, how can I do this?
I found out I can't use javascript fileIO on my server.
I tried with some PHP, but most my code is in javascript and I can't figure out how to execute some code from a javascript function.
I have something like this in mind:
<body onload="opstart();">
When the body is loaded, I call a javascript function. Can I call some PHP here?
// Get number of votes from txt file
function opstart()
{
}
Inside this, I was thinking about reading the data from a text file and load it into the variable holding the number of votes.