package handlers import ( "log" "net/http" "synlotto-website/models" ) func NewTicket(w http.ResponseWriter, r *http.Request) { log.Println("🎟️ New ticket form opened") err := Tmpl.ExecuteTemplate(w, "new_ticket", map[string]interface{}{ "Page": "new_ticket", "Data": nil, }) if err != nil { log.Println("❌ Template error:", err) http.Error(w, "Error rendering ticket form", http.StatusInternalServerError) } } func SubmitTicket(w http.ResponseWriter, r *http.Request) { r.ParseForm() ticket := models.MyTicket{ DrawDate: r.FormValue("draw_date"), Ball1: r.FormValue("ball1"), Ball2: r.FormValue("ball2"), Ball3: r.FormValue("ball3"), Ball4: r.FormValue("ball4"), Ball5: r.FormValue("ball5"), Thunderball: r.FormValue("thunderball"), } MyTickets = append(MyTickets, ticket) log.Printf("🎟 Ticket for %s: %s %s %s %s %s + %s", ticket.DrawDate, ticket.Ball1, ticket.Ball2, ticket.Ball3, ticket.Ball4, ticket.Ball5, ticket.Thunderball, ) http.Redirect(w, r, "/", http.StatusSeeOther) }