1 click but 2 action - how?

Hello. I’m thinking a situation.
Clicking a “visit website” link from my site will redirect visitor to a site. Its easy know. but, when they click, it will also store the hit number also. Here, I don’t want to send the visitor to a page and save the hit to database and send him to the specific site. Both the hit save and redirection need to be done at a time.

Any Idea would greatly appreciate.

in the link give some php file name like

<a href="somefile.php">

then in that PHP use mysql to store the into in DB and the use

header('Location : url_you_want_him_to_go_to');

That’s the way to do it.
Or you could look into AJAX, but if the visitor has JS disabled it won’t work.

Actually, I’m looking for any other way…

Only two ways to accomplish this… first way is what you described but don’t want to use and second way would be to use AJAX. Write a script that records the click and then sends the visitor to wherever the link is pointing. Just as guido2004 mentioned, you need to keep in mind that this wouldn’t work if JS is disabled.