Modification - Update client

Preparation

Duplicate file list_the_clients.php from Section 3.3 to a file named U-CRUD.php at the root of your Web server.

Updating resources via the web service is complex, so we will first explain its operation.

Sequence diagram representing how a resource is updated:

We can see that the diagram is divided into 2 stages:

Getting the resource to a defined id (1 in the diagram) and creating of the form.

Update resource.

The arrow points to a "get", which corresponds to a resource getting.
This step is important because we need to get the XML file back in order to match it with the data sent by the form before we can call "edit" to update the resource.
Note that we could have modified it otherwise by sending an XML using Javascript, and thus have not used "get" in this process.