如果我有以下表单设置:{{ range $key, $value := .Scores }} <input id="{{$value.Id}}_rating__1" type="radio" name="rating[{{$value.Id}}]" value="-1"> <input id="{{$value.Id}}_rating__0" type="radio" name="rating[{{$value.Id}}]" value="0"> <input id="{{$value.Id}}_rating__2" type="radio" name="rating[{{$value.Id}}]" value="+1">{{ end }}我如何才能正确提取该数据?知道.Scores可以包含多个结构func categoryViewSubmit(w http.ResponseWriter, r *http.Request) { err := r.ParseForm() if err != nil { log.Fatal(err) } fmt.Println("POST") fmt.Printf("%+v\n", r.Form()) // annot call non-function r.Form (type url.Values) fmt.Printf("%+v\n", r.FormValue("rating")) // Returns nothing}
2 回答
- 2 回答
- 0 关注
- 145 浏览
添加回答
举报
0/150
提交
取消