as the above stated, I wish to make once user click the hyperlink and it should copy into a variable in PHP. Is it possible to do it?
This is what I have tried but nothing seems to come out?
Code:
<script type="text/javascript">
function getdl(){
var dlink = (document.getElementById('getdllink').getAttribute('onclick'))
<? $url ?> = var dlink
}
</script>
<a id="getdllink" onclick="getdl()" href="#"><strong>Master Prospectus</strong></a></font>
<? echo $url; ?>
I did something wrong? Please help. Thanks!
It’s not possible what you are doing … But it can be done by ajax.
What php does is:
So you need to make an ajax call and assign it to the php variable.
I would suggest you use jquery. It’s very simple and effective.
You can send the data by
jquery:
and in some.php
the above method won’t need to refresh the page
to send this by url check the @PLB answer, it’s good