You will need to do 3 things:

1) create a variable for your input text
2) write a function to set your variable
3) call the function when you click on the buttons.

1) to create the variable,...