Identifying Tours to Edit
Let's identify tours to allow users to edit them.
We'll cover the following...
Giving a unique identifier to each tour
We have successfully built a form that enables the user to add a tour to the list of tours.
The next step will be to allow the user to edit the tour in case they made a typo or if they just want to change part of its data.
Before we can do that, we need a way to identify the tour that we want to edit.
So whenever we create a tour and add it to the $toursData
array, we should also add an id
property to give it a unique identifier (ID).
A unique ID could be a number that hasn’t been used before.
We suggest you count the number of tours we have in $toursData
...