Initial commit

This commit is contained in:
markp88
2022-01-05 15:18:26 -05:00
commit 9ae003506c
794 changed files with 22908 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package main
import (
"net/http"
"strconv"
)
func ProcessFormData(writer http.ResponseWriter, request *http.Request) {
if (request.Method == http.MethodPost) {
index, _ := strconv.Atoi(request.PostFormValue("index"))
p := Product {}
p.Name = request.PostFormValue("name")
p.Category = request.PostFormValue("category")
p.Price, _ = strconv.ParseFloat(request.PostFormValue("price"), 64)
Products[index] = p
}
http.Redirect(writer, request, "/templates", http.StatusTemporaryRedirect)
}
func init() {
http.HandleFunc("/forms/edit", ProcessFormData)
}