PHP Classes

File: deletecompany.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   Leaflet PHP MySQL Map   deletecompany.php   Download  
File: deletecompany.php
Role: Example script
Content type: text/plain
Description: Example
Class: Leaflet PHP MySQL Map
Manage a Leaflet based map with locations in MySQL
Author: By
Last change: DB config
Date: 6 years ago
Size: 2,487 bytes


Class file image Download
$arr = $conn->getCompaniesList();
<!DOCTYPE html>
  <title>Delete a company</title>
  <script src="js/jquery.min.js"></script>
  <link rel="stylesheet" href="css/leaflet.css" />
  <script src="js/leaflet.js"></script>
  <div id="map" style="width: 600px; height: 400px"></div>
  <form action="deletecompanydb.php" method="POST">
   <h1>Delete a company</h1>
   <table cellpadding="5" cellspacing="0" border="0">
     <tr align="left" valign="top">
      <td align="left" valign="top">Company name</td>
      <td align="left" valign="top"><select id="company" name="company"><option value="0">Please choose a company</option><?php for( $i=0; $i < count($arr); $i++) { print '<option value="'.$arr[$i]['id'].'">'.$arr[$i]['company'].'</option>'; } ?></select></td>
     <tr align="left" valign="top">
      <td align="left" valign="top"></td>
      <td align="left" valign="top"><input type="submit" value="Delete"></td>
   var map ='map').setView([51.505, -0.09], 13);

   L.tileLayer( '{z}/{x}/{y}?access_token=pk.eyJ1IjoibWVnYTYzODIiLCJhIjoiY2ozbXpsZHgxMDAzNjJxbndweDQ4am5mZyJ9.uHEjtQhnIuva7f6pAfrdTw', {
    maxZoom: 18,
    attribution: 'Map data &copy; <a href=""> OpenStreetMap </a> contributors, ' +
    '<a href=""> CC-BY-SA </a>, ' +
    'Imagery ? <a href=""> Mapbox </a>',
    id: ''
   function putDraggable() {
    /* create a draggable marker in the center of the map */
    draggableMarker = L.marker([ map.getCenter().lat, map.getCenter().lng], {draggable: true, zIndexOffset: 900}).addTo(map);
    /* collect Lat,Lng values */
    draggableMarker.on('dragend', function(e) {
   $( document ).ready(function() {
    $("#company").change(function() {
     for(var i=0; i <arr.length; i++) {
      if(arr[i]['id'] == $('#company').val()) {
       map.panTo([arr[i]['latitude'], arr[i]['longitude']]);
       draggableMarker.setLatLng([arr[i]['latitude'], arr[i]['longitude']]);
   var arr = JSON.parse( '<?php echo json_encode($arr) ?>' );