According to section 38 of the 1979 immigration act, “House owners, heads of household, landlords or managers of hotels who accommodate foreign nationals on a temporary basis who stay in the kingdom legally, must notify the local immigration authorities within 24 hours from the time of arrival of the foreign national.”
Of course, most people don’t do this as it is not common knowledge. But this might all change soon. At least in Phuket. They are running a publicity campaign at the moment to inform people of this law. They will then start cracking down at the end of next month. The form you need is “Notification of residence for foreigners” (TM30). You can either submit it in person or send via post. For hotels, they can do it online.