Apart from the Tourist Visa (TR), there are other categories depending on the purpose of your visit to Thailand. Briefly, these types of visa are:
B – Business or paid employment
ED – Education or unpaid work
M – Media
O – Other
It is up to you as an individual to ensure you obtain the appropriate visa for your visit. Even if you are being advised or helped by contacts within Thailand, the onus is on you to obtain the correct visa. Contact your nearest Thai embassy/consulate for details or advice.
It is illegal to work in Thailand without the proper visa and documents. Yes, people do it (often with the full knowledge and backing of their Thai employer), but it is still illegal.