# How to add text to text field upon button/image click?

**URL:** <https://forum.kirupa.com/t/how-to-add-text-to-text-field-upon-button-image-click/55362>\
**Category:** web dev\
**Created:** [June 23, 2004, 8:56am UTC](https://forum.kirupa.com/t/how-to-add-text-to-text-field-upon-button-image-click/55362 "2004-06-23T08:56:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtesp](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jtesp](https://forum.kirupa.com/u/jtesp)\
**Post date:** [June 23, 2004, 8:56am UTC](https://forum.kirupa.com/t/how-to-add-text-to-text-field-upon-button-image-click/55362/1 "2004-06-23T08:56:03Z")

</div>

Just like how these smilies work when posting here ---------\>

I want to be able to add the current date to a text area when I click on a “date button/image”. (It needs to add it at the current cursor position in the text area)

Also, I am using PHP…would it be possible to add a variable like $name so that whoever is logged in and clicks that button, their respective name shows?

Basically I need a quick way to add a “current date, time, and user stamp” to a text area. I am doing this so that I have a log of who and when notes were added to that particular text area.

Thanks!
