-
Notifications
You must be signed in to change notification settings - Fork 3
/
loan_type_add.php
executable file
·113 lines (90 loc) · 2.16 KB
/
loan_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
<?
require ("settings.php");
if(isset($_POST["key"])){
switch($_POST["key"]){
case "confirm":
$OUTPUT = confirm_loan ($_POST);
break;
case "write":
$OUTPUT = write_loan ($_POST);
break;
default:
$OUTPUT = get_loan ();
}
}else {
$OUTPUT = get_loan ();
}
require ("template.php");
function get_loan ()
{
$display = "
<h2>Add New Loan Type</h2>
<table ".TMPL_tblDflts.">
<form action='".SELF."' method='POST'>
<input type='hidden' name='key' value='confirm'>
<tr>
<th>Loan Type</th>
</tr>
<tr class='".bg_class()."'>
<td><input type='text' name='loan_type'></td>
</tr>
<tr><td><br></td></tr>
<tr>
<td><input type='submit' value='Next'></td>
</tr>
</table><br>"
.mkQuickLinks(
ql("salwages/loan_apply.php", "Apply for Loan"),
ql("loan_type_add.php", "Add Loan Type"),
ql("loan_type_view.php", "View Loan Types")
);
return $display;
}
function confirm_loan ($_POST)
{
extract ($_POST);
$display = "
<h2>Confirm New Loan Type</h2>
<table ".TMPL_tblDflts.">
<form action='".SELF."' method='POST'>
<input type='hidden' name='key' value='write'>
<input type='hidden' name='loan_type' value='$loan_type'>
<tr>
<th>Loan Type</th>
</tr>
<tr class='".bg_class()."'>
<td>$loan_type</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td><input type='submit' value='Confirm'></td>
</tr>
</table><br>"
.mkQuickLinks(
ql("loan_type_add.php", "Add Loan Type"),
ql("loan_type_view.php", "View Loan Types")
);
return $display;
}
function write_loan ($_POST)
{
extract ($_POST);
db_connect ();
$insert_sql = "INSERT INTO loan_types (loan_type) VALUES ('$loan_type')";
$run_insert = db_exec($insert_sql) or errDie("Unable to store loan type information");
return "
<table ".TMPL_tblDflts.">
<tr>
<th>Information Saved</th>
</tr>
<tr class='".bg_class()."'>
<td>Loan Type Has Been Added</td>
</tr>
</table><br>"
.mkQuickLinks(
ql("salwages/loan_apply.php", "Add Loan Application"),
ql("loan_type_add.php", "Add Loan Type"),
ql("loan_type_view.php", "View Loan Types")
);
}
?>