mardi 20 octobre 2015

Using a URL to make changes to the database

Consider I have to make UPDATEs or INSERTs to a database. Typically, you use a form to do so (with POST parameters)

I am wondering if it is a valid design pattern to use URLs to do so. For example, in a school application, if I want to record the attendance of a student today, I will have 2 buttons saying Present and Absent and both will be links (URL Patterns) for example

<a href="\attendance\39\present">Student 39 is Present today</a>         
<a href="\attendance\39\absent">Student 39 is Absent today</a>

and then, in the logic (controller) I will add into the database a new record saying the student is absent or present that day.

I am trying to find out if anybody out there uses such a method to do it, and whether this is a valid method.




Aucun commentaire:

Enregistrer un commentaire