<div class="container"> <form class="form-horizontal form-group" role="form" action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post" enctype="multipart/form-data"> <div class="col-sm-12 form-group"> <button class="btn btn-lg btn-warning center-block" type="submit" name="generate">Update Map</button> </div> </form> </div> <!--container--> <?php require_once __DIR__ . '/../../../businessLogic/business.php'; $business = new business(); if (isset($_POST["generate"])) { $data = $business->view_companies(); $encoded_data = json_encode($data); $fileJSON = "company.json"; file_put_contents($fileJSON, $encoded_data); require_once 'generateGeoJSON.php'; }