Closed letran3691 closed 3 years ago
Use c.FormParams()
get form as map. c.FormValue("role")
and c.Request().FormValue("role")
returns first value
func main() {
e := echo.New()
e.POST("/permiss", func(c echo.Context) error {
valueMap, _ := c.FormParams()
log.Print(valueMap["role"])
return c.String(http.StatusOK, "OK")
})
if err := e.Start(":8080"); err != nil {
log.Fatal(err)
}
}
curl 'http://localhost:8080/permiss' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-raw 'role=admin&role=add&role=edit'
thank very much
Hello
I've issues when get multiple checked
code html
function get requests
however it's return a null arry
2021/05/14 16:28:37 role []
i've try c.FormValue["role"], but it's return only first value get