if you don't want the page to reload eveytime then you have to do it with javascript. with php it will need to be reloaded.

javascript will have to be run as you would need the postion of the mouse cursor and then save those positions to a file with php.

other than that I don't think you can do it any other way.