Update posts controller to handle form submission