RE: [PHP] count link clicks
| From: | Mike Dunlop | Date: | Tue, 13 Aug 2002 19:38:02 +0000 |
| Subject: | RE: [PHP] count link clicks | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112416@lists.php.net to get a copy of this message | ||
You need to use a javascript (client side language) if you want to accomplish this without reloading the page.
Something like thike this but you would need to do some more R&D at a javascript form or something cuz I know PHP a lot better than javascript
=======================================================================================================================
The functions:
<script language="Javascript">
var count;
function addForm() {
if(!count) { count=0; }
writeForm(count);
count++;
}
function writeForm(num) {
var link = '<a href="javascript:void(0);" onMouseDown="addForm('+num+');">'
}
</script>
You're link:
<a href=\"javascript:void(0);\" onMouseDown=\"addForm();\">
More stuff here...
Really? That sounds more complicated than I think I need it to be, can't I use something like: '<a href="'.$PHP_SELF.'?add_form='.$value.'">' and somehow (this is what I need to know) get $value to increase in value as the user clicks on the link again and again... What I want to do in the final product is to display a text imput form onece and if the user clicks on the link the form (same) will be displayed again under the first one. - Vic -----Original Message----- From: Rasmus Lerdorf [mailto:rasmus@php.net] Sent: Tuesday, August 13, 2002 2:49 PM To: victor@argilent.com Cc: php-general@lists.php.net Subject: Re: [PHP] count link clicks Write a link wrapper that you would use like this: <a href="wrap.php/www.domain.com/path/file.html"> Then in wrap.php: <?php-- Mike Dunlop Webmaster Animation World Network webmaster@awn.com http://www.awn.com (323) 606-4238 office (323) 466-6619 fax 6525 Sunset Blvd. GS10 Los Angeles, CA 90028 USA$link = substr($PATH_INFO,1); ... increment counter in database for $link ... header('Location: $link');?> -Rasmus On Tue, 13 Aug 2002 victor@argilent.com wrote:How do I count how many times a user clicks on a certain link? (andputit into and array or variable I guess). I want to be able to repeat a certain action on the same page as many times as the user clicks on the link($PHP_SELF). Thanks, - Vic ______________________________________________________________________ Post your ad for free now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ______________________________________________________________________ Post your ad for free now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php