LIKE button in PHP increase value

Hello, today i have problems with creating a like button in the php form. More detailed, i have form which show datas about the song ( according to the song id) Ok, and its work good. But i disabled almost whole form, only input that is clickable is button that has value="<?php echo $likes++ ?> . When i click on it, i would like to update table in database by adding +1 to the cureent value. So if this song has 3 likes now, on button click it should has 4 . My php code for it was:

<? php

$connection to the db;


if( isset['nameofbutton"]){
      $nameofbutton = $_POST['nameofbutton'];

 $qry=''UPDATE TABLE SONG SET   likes = nameofbutton+1 where song_id= $id';
.....

$id is already known, because its defined in the previous php code when displaying the data in form.
The problem is that when i click like, the other input, even its disabled, is changed and when i refresh the page the likes value just increase for 1. Why?

Sponsor our Newsletter | Privacy Policy | Terms of Service