Why is my submit button not working and giving an error message?