We can't offer specific code examples, but in principle it would work the same as writing a generic form-handler type of script (e.g. to receive data from a contact form or a page with other data-entry fields), so you might look for tutorials or examples of that to scrutinize.