Here's an interesting problem -
On one of my pages, I have a place where a user can download a
ZIP file by clicking on the phrase "Click to download". I want
to call a logging function that I use to show that the file was
downloaded. The file being downloaded is called file1.zip.
What I now do is the following:
<a href= "..\..\download s\file1.zip">
<?php logvisitor('fil e1.zip'); ?>Click to download.</a>
which produces the following HTML
<a href = "..\..\download s\file1.zip" >Click to download.</a>
So far so good.
But -- here's the problem -- the function logvisitor() is
always called even if the user didn't click on the link.
By placing the PHP function inside the anchor, I had assumed
it too would only be called if the user clicked.
I've also tried the following:
<a href="<?php logvisitor('fil e1.zip');
echo '..\..\download s\file1.zip'; ?> >
Click here to download.</a>
and get the same result, namely, that the PHP function is
always called.
Anybody know how to call the function if and only if the
user clicks on the phrase?
--
Jim
On one of my pages, I have a place where a user can download a
ZIP file by clicking on the phrase "Click to download". I want
to call a logging function that I use to show that the file was
downloaded. The file being downloaded is called file1.zip.
What I now do is the following:
<a href= "..\..\download s\file1.zip">
<?php logvisitor('fil e1.zip'); ?>Click to download.</a>
which produces the following HTML
<a href = "..\..\download s\file1.zip" >Click to download.</a>
So far so good.
But -- here's the problem -- the function logvisitor() is
always called even if the user didn't click on the link.
By placing the PHP function inside the anchor, I had assumed
it too would only be called if the user clicked.
I've also tried the following:
<a href="<?php logvisitor('fil e1.zip');
echo '..\..\download s\file1.zip'; ?> >
Click here to download.</a>
and get the same result, namely, that the PHP function is
always called.
Anybody know how to call the function if and only if the
user clicks on the phrase?
--
Jim
Comment