Possible Duplicate:
How to copy to the clipboard in JavaScript?
I have an html markup thats echoed and is wrapped in a textarea and its also a read only like so:
<textarea rows="4" cols="70" readonly="readonly">text with markup goes here.</textarea>
how do I do it that when a user clicked on the read-only text area contents, it will be automatically selected and copied to the clipboard and with a notification that its already copied?
PHP is server-side so you won’t be able to do anything to interact with the client. In terms of client-side then javascript can do something. The bad news is that Firefox doesn’t allow this any more as far as I recall (I remember seeing some debate around it regarding TinyMCE’s clipboard functionality) so the odds are you’ll need something mixing flash and js to get a fully cross-browser solution.
Might I thus suggest http://code.google.com/p/zeroclipboard/ as a possibility?