I have created a form on a custom wordpress page template that will take some information inserted from the user and a geolocalized map position that will unlock the save button after the desired position is reached. I need to save the data inside the wordpress database, and someone suggested me to use a custom post type. I'm not experienced with wordpress and I need some help to create the right logic to save this data. I've prototypied the form only for now, this because I'm not sure how to proceed, so if the best way is to use a dedicated database table or if I can rely on a custom post type that will show the requested info after that an user doing a research. In particular with the custom post type, the problem is where I can store the latitude and longitude from the map and the n and m fields informations that are important to get search results. I've already customized the search form and the search result of wordpress, I'm thinking about the creation of a shortcode to load the map and the position marker on it when a search result link is clicked by the user, but not sure about.
here is the form code, please help me with some code snippet to find a best approach:
<div class="container">
<div class="row justify-content-center">
<div class="col-sm-12 col-md-6 col-lg-6 shadow-lg" style="padding:1em;">
<form method="POST" action="">
<div class="form-row">
<div class="col-sm-12 col-md-6 col-lg-6">
<label><?php _e('Name'); ?></label>
<input type="text" class="form-control" id="" name="" placeholder="First name">
</div>
<div class="col-sm-12 col-md-6 col-lg-6">
<label><?php _e('Last name'); ?></label>
<input type="text" class="form-control" id="" name="" placeholder="Last name">
</div>
<div class="col-sm-12 col-md-4 col-lg-4">
<label><?php _e('N'); ?></label>
<input type="date" class="form-control" id="" name="">
</div>
<div class="col-sm-12 col-md-4 col-lg-4">
<label><?php _e('M'); ?></label>
<input type="date" class="form-control" id="" name="">
</div>
<div class="col-sm-12 col-md-4 col-lg-4">
<label><?php _e('Position'); ?></label>
<button class="btn btn-outline-primary" id="" href="#"><i class="fas fa-map-marker-alt"></i></button>
</div>
</div>
<button type="" class="btn btn-outline-secondary"><?php _e('Add'); ?></button>
<button type="reset" class="btn btn-outline-danger"><?php _e('Cancel'); ?></button>
</form>
</div>
</div>
</div>
The position button will open a modal that contain a geolocalization map and a button that when pressed will take the lat
and lng
and will add them to a field, unlocking also the add button to send the information to the database.