Answer the question
In order to leave comments, you need to log in
How to give the user the ability to select a location on the map and store the coordinates of the selected location in the database?
I want to create a form that the user will fill in some data. And in this form I want to put a map which the user will indicate the location (of the subject, its location ... ). I need to do so that when receiving data from a form on the server, the coordinates of the selected place by the user come. And what card is better to choose?
Answer the question
In order to leave comments, you need to log in
You can use the Leaflet library to display the map. This page has an example of usage and links to documentation and examples: leafletjs.com
You need to process a click on the map, get the coordinates and send it to the server along with other data from the form.
Yes, you can implement it on any engine - even on Yandex, even on Google. The bottom line is that the value in the form field gets when the user pokes on the map. The value can be stored as a string or in two float variables. If you store it as a string, it will be more difficult to search for the nearest values in the database (points within a radius of XXXm).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question