User input in HTML form not captured in Python correctly