How to count clicks on link, download a file and update a database on php

Thanks to all of you.
I was able to find a solution by combining html, php and javascript.
Wow, I’m very surprise to get it done even when I actually know a little of php and javascript by it was mostly due the existence of forums like this where you can pick bits from here and there until get a solution to any programming issue.

Thanks a lot