-
Notifications
You must be signed in to change notification settings - Fork 1
/
loanrepay.php
86 lines (64 loc) · 1.82 KB
/
loanrepay.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
<!DOCTYPE html>
<html>
<head>
<title>APPLY FOR LOANS!</title>
<link rel="stylesheet" href="loanrepay.css">
</head>
<body>
<aside class = "left">
<nav>
<img src="log.jpg"/>
<a href="homepage.php" >Home</a>
<a href="accover.php">Account Overview</a>
<a href="showtransact.php" >View Statement</a>
<a href="payment.html" >Utility Payment</a>
<a href="custreq.html" >Service Request</a>
<a href="loanapply.html" >Apply for loan</a>
<a href="loanrepay.php" class="active">Loan payment</a>
<a href="makefd.html">Make Fixed Deposit</a>
</nav>
</aside>
<?php
$accnum=$_COOKIE['accnum'];
$link=mysqli_connect("localhost","root","","aakash");
$a=1;
$query="SELECT accnum FROM customer";
$d=mysqli_query($link,$query);
while ($row=mysqli_fetch_assoc($d))
{
if($row['accnum']==$accnum)
{ $a=0; break;}
}
if($a==1)
{ echo "user does not exist"; exit; }
$query1="SELECT loannum from loan where accnum='$accnum';";//"SELECT paymentmt from loan,loanpayment where loan.loannum=loanpayment.loannum and loan.accnum='$accnum';"
$result1=mysqli_query($link,$query1);
$a=mysqli_fetch_assoc($result1);
$loannum=$a['loannum'];
$query2="SELECT paymentamt from loanpayment where loannum=$loannum;";
$result2=mysqli_query($link,$query2);
$b=mysqli_fetch_assoc($result2);
$amt=$b['paymentamt'];
setcookie("amot", $amt);
if($query1 && $query2){ ?>
<html>
<body>
<h2>Amount payable:<?php echo $amt; ?></h2>
<h3> To pay click submit </h3>
<div class="login-page">
<div class="form">
<form method="POST" id="form1" action="loanpayment.php">
<button type="submit" form="form1" value="Submit">Submit</button>
</form>
</div>
</div>
</body>
</html>
<?php
}
else{
echo "error";
}
?>
</body>
</html>