public function generateWithParams() { //the posted value from dimensions is inserted into the session variable $_SESSION["dimension"] = $_POST["dimension"]; $_SESSION["startNrPlants"] = $_POST["startNrPlants"]; $_SESSION["startNrCarnivores"] = $_POST["startNrCarnivore"]; $_SESSION["startNrHerbivores"] = $_POST["startNrHerbivore"]; //If the amount of plants+Carnivores+Herbivores is higher than the amount of squares in the matrix //then there is a message for the matrix being too full. if ($_SESSION["startNrPlants"] + $_SESSION["startNrCarnivores"] + $_SESSION["startNrHerbivores"] >= pow($_SESSION["dimension"], 2)) { include 'Presentation/home.php'; } else { $matrix = new test(); $_SESSION['days'] = $matrix->simulate(); $days = $_SESSION['days']; $_SESSION['daynumber'] = 0; $daynumber = $_SESSION['daynumber']; $day = $days[$daynumber]; include 'Presentation/home.php'; //header("location: ../Presentation/home.php"); } }