I have the following code.
<div onClick=registerationform.pdf>something</div>
<?php
header('Content-disposition: attachment; filename=registerationform.pdf');
header('Content-type: application/pdf');
readfile('registerationform.pdf');
This code directly downloads the output if the page is loaded. But I need the pdf to get downloaded only if the something button is clicked.Help me