title: I want to draw the road map when i select the few location using checkbox.
body: <p>I want to draw the road map when i select the few location using check boxes in form.php. I post that locations into map.php file, I assign that posted values into $location array and now I want to assign that $location array values into javascript calcRoute() function's waypoints array. How can I do that ?</p>
  
  <pre><code>&lt;form action="map.php" method="post"&gt;
  
  &lt;input type="checkbox" name="check_list[]" value="horton" name="wildlife"&gt; Horton Plains National Park &lt;br&gt;
  &lt;input type="checkbox" name="check_list[]" value="minneriya " name="wildlife"&gt; Minneriya National Parks &lt;br&gt;
  &lt;input type="checkbox" name="check_list[]" value="galoye" name="wildlife"&gt; Galoye National park&lt;br&gt;
  &lt;input type="checkbox" name="check_list[]" value="udawalawa" name="wildlife"&gt; Uda Walawe National Park&lt;br&gt;
  &lt;input type="checkbox" name="check_list[]" value="wasgamuwa" name="wildlife"&gt; Wasgomuwa National Park&lt;br&gt;
  &lt;input type="checkbox" name="check_list[]" value="yala" name="wildlife"&gt; Yala West (Ruhuna) National Park 
  
  &lt;/form&gt;
  
  
  &lt;?php
  $location = array();
  if(isset($_POST['submit'])){
      if(!empty($_POST['check_list'])){
          foreach($_POST['check_list'] as $selected){
              $location = $selected;   
          }
      }
  }
  </code></pre>
  
  <p>?></p>
  
  <pre><code>function calcRoute() {
    var request = {
    origin: 'Colombo',
    destination: 'Colombo',
    waypoints:[{location: 'Kandy'}, {location: 'gampaha'}, {location: 'jaffna'}],  
    travelMode: google.maps.TravelMode.DRIVING
  };
    directionsService.route(request, function(response, status) {
    if (status == google.maps.DirectionsStatus.OK) {
       directionsDisplay.setDirections(response);
    }
  });
  </code></pre>
  
  <p>}</p>