Zh GoogleMap RSForm

From Documentation
Revision as of 12:10, 6 March 2017 by Admin (talk | contribs)
Jump to navigation Jump to search

Before this time I didn't use forms, created by RSForm.


In February 2017, user of my extension Phillip ask me to help with integration with RSForm! Pro.


I checked RSFrom docs and tutorials and understand that it is very easy.


This forms can do insert into any your database tables. And I store all data in tables.


The main task was - create placemark from filled form fields.


Lets do that.


First of all you have to configure your form, and create map field.


Look at image, the field Where is store position on map.


After that lets go to see how it is displayed on site.


Now lets come back to form configuration and do the integration.

1 - in Form properties, Section PHP Scripts, I added parsing Where field. In part Script called after form has been processed added this code

foreach($mappings as $mapping)
{
  $data = unserialize($mapping->data);
  $coords = explode(",", $_POST['form']['Where']); 
  $lat = $coords[0];
  $lng = $coords[1];

  $data["latitude"] = strip_tags($lat);
  $data["longitude"] = strip_tags($lng);

  $mapping->data = serialize($data);
}