-
Notifications
You must be signed in to change notification settings - Fork 8
/
createLocation.php
33 lines (25 loc) · 992 Bytes
/
createLocation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once 'classes/Location.php';
require_once 'classes/LocationTableGateway.php';
require_once 'classes/Connection.php';
require_once 'validateLocation.php';
$formdata = array();
$errors = array();
validateLocation(INPUT_POST, $formdata, $errors);
if (empty($errors)) {
$locationName = $formdata['Name'];
$locationAddress = $formdata['Address'];
$managerFName = $formdata['managerFName'];
$managerLName = $formdata['managerLName'];
$managerEmail = $formdata['managerEmail'];
$managerNumber = $formdata['managerNumber'];
$maxCap = $formdata['maxCap'];
$location = new Location(-1, $locationName, $locationAddress, $managerFName, $managerLName, $managerEmail, $managerNumber, $maxCap);
$connection = Connection::getInstance();
$gateway = new LocationTableGateway($connection);
$id = $gateway->insert($location);
header('Location: homeIn.php');
}
else {
require 'createLocationForm.php';
}