0
我試圖做出處理程序來更新每次從submitt按鈕獲取一行數據, 這裏是我的代碼:golang:不能執行t.execute
func RowHandler(res http.ResponseWriter, req *http.Request) {
if req.Method != "POST" {
http.ServeFile(res, req, "homepage.html")
return
}
Person_id := req.FormValue("Person_id")
stmt, err := db.Prepare("update Cityes set Status='right' where Person_id=?")
if err != nil {
log.Print("error ", err)
}
_, err = stmt.Exec(&Person_id)
t, err := template.ParseFiles("city_update.html") //hier i just want to show a text in html Page
if err != nil {
log.Fatal(err)
}
err = t.Execute(res, "/city_update")
}
共享代碼片段的當前行爲是什麼? –
我收到了:// – tery
針對'/'的多次註冊:看起來您的路線不正確。嘗試打印/記錄formdata並查看即將發生的事情。 –