-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit-result.php
More file actions
149 lines (119 loc) · 6.76 KB
/
edit-result.php
File metadata and controls
149 lines (119 loc) · 6.76 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php include('includes/header.php'); ?>
<!-- Page body -->
<div class="page-body">
<div class="container-xl">
<div class="row row-deck row-cards">
<?php
$stid = intval($_GET['stid']);
if (isset($_POST['submit'])) {
$rowid = $_POST['id'];
$marks = $_POST['marks'];
foreach ($_POST['id'] as $count => $id) {
$mrks = $marks[$count];
$iid = $rowid[$count];
for ($i = 0; $i <= $count; $i++) {
$sql = "update tblresult set marks=:mrks where id=:iid ";
$query = $dbh->prepare($sql);
$query->bindParam(':mrks', $mrks, PDO::PARAM_STR);
$query->bindParam(':iid', $iid, PDO::PARAM_STR);
$query->execute();
$msg = "Result info updated successfully";
}
}
}
?>
<div class="row page-title-div">
<div class="col-md-6">
<h2 class="title">Student Result Info</h2>
</div>
<!-- /.col-md-6 text-right -->
</div>
<!-- /.row -->
<div class="row breadcrumb-div">
<div class="col-md-6">
<ul class="breadcrumb">
<li><a href="dashboard.php"><i class="fa fa-home"></i> Home</a></li>
<li class="active">/ Result Info</li>
</ul>
</div>
</div>
<!-- /.row -->
</div>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-heading">
<div class="panel-title">
<h5>Update the Result info</h5>
</div>
</div>
<div class="panel-body">
<?php if ($msg) { ?>
<div class="alert alert-success left-icon-alert" role="alert">
<strong>Well done!</strong><?php echo htmlentities($msg); ?>
</div><?php } else if ($error) { ?>
<div class="alert alert-danger left-icon-alert" role="alert">
<strong>Oh snap!</strong> <?php echo htmlentities($error); ?>
</div>
<?php } ?>
<form class="form-horizontal" method="post">
<?php
$ret = "SELECT tblstudents.StudentName,tblclasses.ClassName,tblclasses.Section from tblresult join tblstudents on tblresult.StudentId=tblresult.StudentId join tblsubjects on tblsubjects.id=tblresult.SubjectId join tblclasses on tblclasses.id=tblstudents.ClassId where tblstudents.StudentId=:stid limit 1";
$stmt = $dbh->prepare($ret);
$stmt->bindParam(':stid', $stid, PDO::PARAM_STR);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_OBJ);
$cnt = 1;
if ($stmt->rowCount() > 0) {
foreach ($result as $row) { ?>
<div class="form-group">
<label for="default" class="col-sm-2 control-label">Programme</label>
<div class="col-sm-10">
<?php echo htmlentities($row->ClassName) ?>(<?php echo htmlentities($row->Section) ?>)
</div>
</div>
<div class="form-group">
<label for="default" class="col-sm-2 control-label">Full Name</label>
<div class="col-sm-10">
<?php echo htmlentities($row->StudentName); ?>
</div>
</div>
<?php }
} ?>
<?php
$sql = "SELECT distinct tblstudents.StudentName,tblstudents.StudentId,tblclasses.ClassName,tblclasses.Section,tblsubjects.SubjectName,tblresult.marks,tblresult.id as resultid from tblresult join tblstudents on tblstudents.StudentId=tblresult.StudentId join tblsubjects on tblsubjects.id=tblresult.SubjectId join tblclasses on tblclasses.id=tblstudents.ClassId where tblstudents.StudentId=:stid ";
$query = $dbh->prepare($sql);
$query->bindParam(':stid', $stid, PDO::PARAM_STR);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
$cnt = 1;
if ($query->rowCount() > 0) {
foreach ($results as $result) { ?>
<div class="form-group">
<label for="default" class="col-sm-2 control-label"><?php echo htmlentities($result->SubjectName) ?></label>
<div class="col-sm-10">
<input type="hidden" name="id[]" value="<?php echo htmlentities($result->resultid) ?>">
<input type="text" name="marks[]" class="form-control" id="marks" value="<?php echo htmlentities($result->marks) ?>" maxlength="5" required="required" autocomplete="off">
</div>
</div>
<?php }
} ?>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" name="submit" class="btn btn-primary">Update</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- /.col-md-12 -->
</div>
</div>
</div>
</div>
</div>
<?php include('includes/footer.php'); ?>
<?php //}
?>