-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocations-Add.php
75 lines (70 loc) · 4.09 KB
/
Locations-Add.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php require_once 'includes/initialize.php';
if(isset($_POST['submit'])){
$location = new Location();
$location->name = trim($_POST['name']);
$location->prefix= trim($_POST['prefix']);
$location->sno = trim($_POST['sno']);
$check = Location::check_existing($location->name,0);
//CHECK if user already exists
if($check){
$message = "<div class=\"alert alert-error\">Location already exists!</div>";
$session->message($message);
redirect_to("Locations-Add.php");
}
// $location->save();
if($location && $location->save()){
//// SEND EMAIL FROM HERE
$message = "<div class=\"alert alert-success\">Location saved successfully</div>";
$session->message($message);
if ($_POST['action'] == 1 ){
// do s
redirect_to("Locations.php");
} else if ($_POST['action'] == 2 ){
//
redirect_to("Locations-Add.php?action={$_POST['action']}");
}
} else {
$message = "<div class=\"alert alert-error\">An error occured!</div>";
}
}
$p =4;
require_once './layouts/header.php';
?>
</head>
<body>
<?php include_once 'layouts/navigation.php'; ?>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<?php require_once './layouts/options-settings.php'; ?>
</div>
<div class="span10">
<?php if (isset($message)){ echo $message;} ?>
<div class="row-fluid">
<div class="hero-unit table table-bordered span12">
<div><h4>SETTINGS : New Location </h4></div>
<p> </p>
<form id="newform" action="" method="POST">
<div class="span6">
<label class="">LOCATION NAME</label>
<input type="text" class="input-block-level required-entry " placeholder="Input Location" title="Input Location " name="name" required />
<label class="">LOCATION CERTIFICATE PREFIX</label>
<input type="text" class="input-block-level required-entry " placeholder="Input Location" title="Input Location " name="prefix" required />
<label class="">LOCATION CERTIFICATE START NO</label>
<input type="number" class="input-block-level required-entry " placeholder="Input Location" title="Input Location " name="sno" required />
<label class="">ACTION</label>
<select name="action" class="input-block-level">
<option value="1" <?php if (isset($action) && $action==1){ echo "selected";} ?>>SAVE AND VIEW ALL LOCATIONS</option>
<option value="2" <?php if (isset($action) && $action==2){ echo "selected";} ?>>SAVE AND ADD NEW</option>
</select>
<p> </p>
<input type="submit" class="btn btn-success btn-large" name="submit" value="SAVE"/> <input type="reset" class="btn btn-warning btn-large" value="CLEAR FORM" />
</div>
</form>
</div>
</div>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
</div>
<?php require_once 'layouts/footer.php';