-
Notifications
You must be signed in to change notification settings - Fork 3
/
bursary_type_add.php
executable file
·122 lines (101 loc) · 2.64 KB
/
bursary_type_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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?
require ("settings.php");
if(isset($_POST["key"])){
switch ($_POST["key"]){
case "confirm":
$OUTPUT = confirm_burs ($_POST);
break;
case "write":
$OUTPUT = write_burs ($_POST);
break;
default:
$OUTPUT = get_burs ();
}
}else {
$OUTPUT = get_burs ();
}
require ("template.php");
function get_burs ()
{
$display = "
<h2>Add New Bursary</h2>
<table ".TMPL_tblDflts.">
<form action='".SELF."' method='POST'>
<input type='hidden' name='key' value='confirm'>
<tr>
<th colspan='2'>Bursary Information</th>
</tr>
<tr class='".bg_class()."'>
<td>Bursary Name</td>
<td><input type='text' size='40' name='bursary_name'></td>
</tr>
<tr class='".bg_class()."'>
<td>Bursary Details</td>
<td><textarea name='bursary_details' rows='6' cols='50'></textarea></td>
</tr>
<tr><td><br></td></tr>
<tr>
<td colspan='2' align='right'><input type='submit' value='Next'></td>
</tr>
</form>
</table><br>"
.mkQuickLinks(
ql("bursary_type_add.php", "Add Bursary"),
ql("bursary_type_view.php", "View Bursaries")
);
return $display;
}
function confirm_burs ($_POST)
{
extract ($_POST);
$display = "
<h2>Confirm New Bursary</h2>
<table ".TMPL_tblDflts.">
<form action='".SELF."' method='POST'>
<input type='hidden' name='key' value='write'>
<input type='hidden' name='bursary_name' value='$bursary_name'>
<input type='hidden' name='bursary_details' value='$bursary_details'>
<tr>
<th colspan='2'>Bursary Information</th>
</tr>
<tr class='".bg_class()."'>
<td>Bursary Name</td>
<td>$bursary_name</td>
</tr>
<tr class='".bg_class()."'>
<td>Bursary Details</td>
<td>".nl2br($bursary_details)."</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td colspan='2' align='right'><input type='submit' value='Confirm'></td>
</tr>
</form>
</table><br>"
.mkQuickLinks(
ql("bursary_type_add.php", "Add Bursary"),
ql("bursary_type_view.php", "View Bursaries")
);
return $display;
}
function write_burs ($_POST)
{
extract ($_POST);
db_connect ();
$write_sql = "INSERT INTO bursaries (bursary_name,bursary_details,date_added,used) VALUES ('$bursary_name','$bursary_details','now','no')";
$runwrite = db_exec($write_sql) or errDie ("Unable to add bursary information.");
return "
<table ".TMPL_tblDflts.">
<tr>
<th>Information Updated.</th>
</tr>
<tr class='".bg_class()."'>
<td>Bursary Has Been Added</td>
</tr>
</table><br>"
.mkQuickLinks(
ql("bursary_type_add.php", "Add Bursary"),
ql("bursary_type_view.php", "View Bursaries")
);
}
?>