If you do know the user-name, then you just need a "user-likes" table where "user-ID" and "topic-ID" are the primary key. Attempt to insert a row. If a matching row already exists, the insert will fail ... and you simply ignore it.
Comment on Re: How to avoid mulitple submission of form in html
Or generate a form-session-id, and when someone tries to submit the same form again, when you encounter an existing form-session-id, refuse to insert into database