-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayments.php
83 lines (68 loc) · 3.07 KB
/
payments.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
<?php
session_start();
if (!isset($_SESSION[username])) {
header("location: formlogin.php");
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css.css" media="all">
<title>Λίστα Αθλητών</title>
<meta charset="utf8">
</head>
<body>
<form method="POST" action="submitpayments.php<?php echo "?id=$_GET[id]";?>" >
<div class="list" >
<table align="center">
<tr>
<th>Επίθετο</th><th>Όνομα</th><th>Ιανουάριος</th><th>Φεβρουάριος</th><th>Μάρτιος</th><th>Αρπρίλιος</th>
<th>Μάιος</th><th>Ιούνιος</th><th>Ιούλιος</th><th>Αύγουστος</th><th>Σεπτέμβρης</th><th>Οκτώμβρης</th><th>Νοέμβρης</th>
<th>Δεκέμβρης</th>
</tr>
<?php
$con=mysqli_connect("localhost","form","*****","form");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_set_charset($con, "utf8");
$result = mysqli_query($con,"SELECT * FROM boxers WHERE id='$_GET[id]'");
while($row = mysqli_fetch_array($result))
{
$payments=decbin($row[payments]);
$len=strlen($payments);
if($len<12){
for($i=0;$i<12-$len;$i++)
$payments="0".$payments;
}
for ($i=0;$i<=11;$i++) {
if($payments[$i]=="1")
$payment[$i]="checked";
}
mysqli_set_charset($con, "utf8");
echo "<tr><td>$row[surname]</td><td>$row[name]</td>
<td><input type=\"checkbox\" name=\"january\" class=\"css-checkbox\" value=\"1\" $payment[0]/></td>
<td><input type=\"checkbox\" name=\"february\" class=\"css-checkbox\" value=\"1\" $payment[1]/></td>
<td><input type=\"checkbox\" name=\"march\" class=\"css-checkbox\" value=\"1\" $payment[2]/></td>
<td><input type=\"checkbox\" name=\"april\" class=\"css-checkbox\" value=\"1\" $payment[3]/></td>
<td><input type=\"checkbox\" name=\"may\" class=\"css-checkbox\" value=\"1\" $payment[4]/></td>
<td><input type=\"checkbox\" name=\"june\" class=\"css-checkbox\" value=\"1\" $payment[5]/></td>
<td><input type=\"checkbox\" name=\"july\" class=\"css-checkbox\" value=\"1\" $payment[6]/></td>
<td><input type=\"checkbox\" name=\"august\" class=\"css-checkbox\" value=\"1\" $payment[7]/></td>
<td><input type=\"checkbox\" name=\"september\" class=\"css-checkbox\" value=\"1\" $payment[8]/></td>
<td><input type=\"checkbox\" name=\"octomber\" class=\"css-checkbox\" value=\"1\" $payment[9]/></td>
<td><input type=\"checkbox\" name=\"november\" class=\"css-checkbox\" value=\"1\" $payment[10]/></td>
<td><input type=\"checkbox\" name=\"december\" class=\"css-checkbox\" value=\"1\" $payment[11]/></td></tr>
";
}
mysqli_close($con);
?>
</table>
</div><br>
<input type="submit" value="Save" class="myButton2"> <a href="list.php"><input type="button" value="Back" class="myButton2"></a> <br><br><br>
<a href="logout.php"><input type="BUTTON" value="Logout" class="myButton2"></a>
</form>
</body>
</html>