how to add a button in my page, which on clicking post the given text in a
What have you tried so far? If you post a link to the code you have tried, we can give you some advice.
I figured it out. I was trying to put the link inside a button tag. That was the problem.