0

Every tutorial or reference I am looking at for tags only apply to if you want to get text or check-box options, etc. I am going to be displaying two images and asking users to vote on whichever image is better (rough concept but you get what I am trying to do.) How do I make the clickable buttons tally votes for each image and then display them on the next page?

VTedd
  • 5
  • 3
  • This cannot be done with xhtml, or even xhtml+javascript, because each time a user votes, the vote has to be added to a total that's stored in the webserver for the site. Then the next page can display the current total. You need a server script language like PHP to do all that. – yitwail Dec 22 '13 at 21:17
  • Best way is to create a mysql database, then add a table that stores whatever data you need to store, then update/retrieve the data from this table. Instead, I suppose you could just make a text file, like `votes.txt`, and put the data in there, but you have to make sure that several users don't read/write to the same file at the same time, with some sort of lock perhaps. Here's stackoverflow Q&A on filelocking: http://stackoverflow.com/questions/5449395/file-locking-in-php – yitwail Dec 22 '13 at 21:22

1 Answers1

0

This is a matter of PHP, PHP is a server-side scripting language. You would need to have a database that would be able to store the data.

PHP: http://php.net/

MySQL: http://www.mysql.com/

Do a little research on it. I'm sure you could find something that would guide you through on how to do it.

  • Thank you. I might want to reconsider what I am actually doing since this is going to be my first real webpage and all I know at the moment is xhtml, css, and javascript. – VTedd Dec 22 '13 at 21:28
  • @VTedd No problem, if it helped remember to vote it best answer. –  Dec 22 '13 at 21:32