henricar Posted April 1, 2011 Share Posted April 1, 2011 Hey guys, I was wondering if it is possible to have a value inserted into a table as someone clicks on a link (in order to count views for example)? thanks! Link to comment https://forums.phpfreaks.com/topic/232360-onclick-execution-of-a-php-command/ Share on other sites More sharing options...
cssfreakie Posted April 1, 2011 Share Posted April 1, 2011 As far as I know this can only be done with Ajax (the onclick insert in to table event that is) May want to look in Jquery ajax Link to comment https://forums.phpfreaks.com/topic/232360-onclick-execution-of-a-php-command/#findComment-1195329 Share on other sites More sharing options...
btherl Posted April 1, 2011 Share Posted April 1, 2011 A common method to count clicks is to use a redirection script. The script takes the destination url as input, records the click, then does a header("Location: $url") redirect. Link to comment https://forums.phpfreaks.com/topic/232360-onclick-execution-of-a-php-command/#findComment-1195365 Share on other sites More sharing options...
Psycho Posted April 1, 2011 Share Posted April 1, 2011 Why not include a file at the top of the page(s) you want to track to add a "click" for each view? Link to comment https://forums.phpfreaks.com/topic/232360-onclick-execution-of-a-php-command/#findComment-1195392 Share on other sites More sharing options...
henricar Posted April 1, 2011 Author Share Posted April 1, 2011 I had thought about doing it that way but the clicks I want to monitor are one to pages external to my website.. plus they open in a new window :s. I think looking into Ajax would be my best bet... Link to comment https://forums.phpfreaks.com/topic/232360-onclick-execution-of-a-php-command/#findComment-1195524 Share on other sites More sharing options...
Psycho Posted April 1, 2011 Share Posted April 1, 2011 I had thought about doing it that way but the clicks I want to monitor are one to pages external to my website.. Then btherl's suggestion would be the easiest to implement Link to comment https://forums.phpfreaks.com/topic/232360-onclick-execution-of-a-php-command/#findComment-1195543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.