refactor html form and php