I have a list of file download urls that will be displayed to user and upon user clicking it will trigger download. I am using the following code:
echo "<a href=$val1 download=\"$fileId.$fileformat\".>Click Here To Download</a>";
But how do I change this so that a function is called instead of download as I need to do some processing before download. I used the following but it is not working:
echo "<a href=$val1 onclick=func($val1,$fileId,$fileformat)>Click Here To Download</a>";
Is there any other way to call a function from hyperlink?
I tried using if(isset($_GET['id'])) way but I have a list of links which I need to display to user and when user clicks one than pass to function to trigger download.