I want to make a voting system using PHP, MySQL and jQuery.
The idea is that when you click on a radiobutton, the vote is inserted into the database.
My question is:
How I can run the query to the database with PHP, detecting the change in the radiobutton using jQuery?
This is my basic idea:
if ($("input:radio[name=vote]:checked").val()){
//HERE I WANT TO RUN A QUERY TO MYSQL WITH PHP
}
I do this because this way if you choose a radiobutton, then inserted a vote for that option. But if I choose another radiobutton (vote for another option), then update the vote.
Thank you very much.
Greetings.