Post-requirement of reading of masses
-
On page tmpl of the document, there is a form:
<form id="createform" name="createform" action="/clickCreateRashod" method="post"> <div class="col-lg-6"> <input id="first" name="first" value="Name1"> <input id="first" name="first" value="Name2"> <input id="first" name="first" value="Name3"> <input id="two" name="two" value="5"> <button type="submit" class="btn" >Add</button> </form>
Duck is how I ginally get the meanings of all three "first." Processor function:
r.POST("/clickCreateRashod", clickCreateRashodHandle)
func clickCreateRashodHandle(c *gin.Context) {
//Тут я писал уже кучу всего, как сделать правильно?
}
For the single value of c.PostForm("first), how do you count everything in the body? The same is true of the standard library.
-
I don't see a gin of this kind of technique, but it's actually done through it. https://golang.org/pkg/net/http/#Request.ParseForm and read directly from
http.Request.Form
by key:r := c.Request err := r.ParseForm() if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } fmt.Println(r.Form["first"])