Using PHP to count how many time a "mailto:" button is click

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
larryc
Forum Newbie
Posts: 2
Joined: Wed Apr 22, 2009 2:02 pm

Using PHP to count how many time a "mailto:" button is click

Post by larryc »

Hello,

I am trying to figure out how to keep track of how many times a "mailto:" button is clicked. It is a button that says Request Ifo and when clicked it brings up the mailto function. I would like to know how many times that button is clicked. I can do a little PHP and a little MySQL. I am just confused how to go about it.

Would I use the JS OnClick function?

This is what my code looks like:

<a href="mailto:info@company.com?subject=I am interested in learning more about your company"><img src="infobutton.gif" alt="" width="175" height="70" border="0" align="right" /></a

Any suggestions or pointing towards the right direction is appreciated.

Thanks

Larry C
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Using PHP to count how many time a "mailto:" button is click

Post by Christopher »

You could use onClick to make an Ajax call back to the server to increment a counter in MySQL. Are you using a Javascript library? It will make doing this much easier.
(#10850)
larryc
Forum Newbie
Posts: 2
Joined: Wed Apr 22, 2009 2:02 pm

Re: Using PHP to count how many time a "mailto:" button is click

Post by larryc »

I am not using a javascript library. Not really sure what I would do in ajax.

I am not the PHP person my first post may have given the impression I was.
Post Reply