-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_student.php
74 lines (61 loc) · 1.95 KB
/
get_student.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
<?php
include('includes/config.php');
if(!empty($_POST["classid"]))
{
$cid=intval($_POST['classid']);
if(!is_numeric($cid)){
echo htmlentities("invalid Class");exit;
}
else{
$stmt = $dbh->prepare("SELECT StudentName,StudentId FROM tblstudents WHERE ClassId= :id order by StudentName");
$stmt->execute(array(':id' => $cid));
?><option value="">Select Category </option><?php
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<option value="<?php echo htmlentities($row['StudentId']); ?>"><?php echo htmlentities($row['StudentName']); ?></option>
<?php
}
}
}
// Code for Subjects
if(!empty($_POST["classid1"]))
{
$cid1=intval($_POST['classid1']);
if(!is_numeric($cid1)){
echo htmlentities("invalid Class");exit;
}
else{
$status=0;
$stmt = $dbh->prepare("SELECT tblsubjects.SubjectName,tblsubjects.id FROM tblsubjectcombination join tblsubjects on tblsubjects.id=tblsubjectcombination.SubjectId WHERE tblsubjectcombination.ClassId=:cid and tblsubjectcombination.status!=:stts order by tblsubjects.SubjectName");
$stmt->execute(array(':cid' => $cid1,':stts' => $status));
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{?>
<p> <?php echo htmlentities($row['SubjectName']); ?><input type="text" name="marks[]" value="" class="form-control" required="" placeholder="Enter marks out of 40" autocomplete="off"></p>
<?php }
}
}
?>
<?php
if(!empty($_POST["studclass"]))
{
$id= $_POST['studclass'];
$dta=explode("$",$id);
$id=$dta[0];
$id1=$dta[1];
$query = $dbh->prepare("SELECT StudentId,ClassId FROM tblresult WHERE StudentId=:id1 and ClassId=:id ");
//$query= $dbh -> prepare($sql);
$query-> bindParam(':id1', $id1, PDO::PARAM_STR);
$query-> bindParam(':id', $id, PDO::PARAM_STR);
$query-> execute();
$results = $query -> fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query -> rowCount() > 0)
{ ?>
<p>
<?php
echo "<span style='color:red'> Result Already Declare .</span>";
echo "<script>$('#submit').prop('disabled',true);</script>";
?></p>
<?php }
}?>