I have an array which shows the cities selected in database as cities=["1","3"] where 1 is Bombay and 3 is bangalore
Now while editing the user deselects Bombay and selects chennai, The new array is ["2","3"]
HTML:
<select name="cities">
<option value="1">Bombay</option>
<option value="2">Chennai</option>
<option value="3">Bangalore</option>
<option value="4">Delhi</option>
<option value="5">Calcutta</option>
</select>
How to get an array which contains the missing values(1) and an array for newly selected (2) so that when compared with selected array, if it is missing should update else should insert in database