package main import ( "html/template" "net/http" ) func handleForm(res http.ResponseWriter, req *http.Request) { data := map[string]string{ "first": req.FormValue("first"), "last": req.FormValue("last"), } tpl, err := template.ParseFiles("form.html") if err != nil { http.Error(res, err.Error(), 500) } else { tpl.Execute(res, data) } } func main() { http.HandleFunc("/", handleForm) http.ListenAndServe(":9000", nil) }