Form submit function implementation