I'm trying to create a Student Attendance web app. Currently have a struct
type Student struct {
StudentID int
StudentName string
Created time.Time
}
All student will be listed on list.html
func ListStudent(w http.ResponseWriter, r *http.Request) {
students := models.Student.ListAllUser()
render.HTML(w, http.StatusOK, "list.html", students)
}
list.html contain list of every students follows with Yes and No button for their attendance.
<p>#{{.StudentID}} {{.StudentName}}</p>
<a class="btn" role="button" href="/studentAttend/{{.StudentID}}">Yes</a>
<a class="btn" role="button" href="/studentAttend/{{.StudentID}}">No</a>
I'm struggle what the backend logic process to do with the button to store the students attendance. The idea is to have a request send to the server with Yes for True or No for False for student attendance that day.
The end goal is to have a table with row of students and column of each day of the month. The column day will have a tick for attend the school day and blank for the day absence along the student row.

I think there are multiple ways to achieve your desired solution. The question you should ask yourself is how much effort you want to invest.
One way (a bit more complex) could be, to implement an additional POST endpoint for the attendance of a student. For example:
This example may require some javascript for the functionality, e.g. binding the submit event on the state of the radio's, add some AJAX to prevent a page reload, styling the two radios to a toggle switch... and so on.
Another way, as already mentioned in the comments, is to add query parameters
/studentAttend/:studentID?value=<yes|no>to your buttons. Also here you could add some javascript to handle the request in the background.Another thing I would change is the field names of the
Studentstruct:This is a more cleaner way when accessing the fields. Instead of e.g.
student.StudentNameyou havestudent.Name.