I don't what the thing is actually called but I try to descripe.
So I have form with couple fields and textarea. Now what I want is that user could add "tags" to textarea and those tags would then be replaced with variables from db/array in code. So for example if the user writes to textarea "Hello how are you {name} today?" then when the form is saved, the {name} would then be replaced with some string from array. How to do it or what is this method called so I could google and learn more about it?
You're looking for a parser. You can use regular expressions and/or string replacements for that. Typically there would be parsing methods for both encoding and decoding. You could implement a class for that. Those functionalities are often used in forums or cms. The simplest example would be smiley codes. Once you understand the workflow of that, you could even use tag-functions. Such as {ListGroup|25} which could produce a list of 25 users of a group.