-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecondsetting.php
More file actions
145 lines (135 loc) · 3.89 KB
/
secondsetting.php
File metadata and controls
145 lines (135 loc) · 3.89 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
<?php
session_start();
include("includes/connect.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>Second setting</title>
<?php
include("includes/banner.php");
include("includes/theader.php");?>
<link rel="stylesheet" type="text/css" href="css/teacher.css">
<script src="js/jquery.js"></script>
<style type="text/css">
#fter{background-color: #5da1a7;height:60px;margin-top: 350px;font-family:corbel;text-align: center;
padding-top: 3px;position: fixed;z-index: 1px;width: 1200px;
}
</style>
</head>
<body>
<div id="fter">
<h3>Allright reserved © by Mucyo Rene</h3>
</div>
<div class="action"><!--this is the division of student links-->
<div id="blankspace">
<!--give the parmission to the teacher before insert marks-->
<br />
<form method="POST">
Choose Year:
<select style="padding-right:50" class=yid name="yid">
<option>Select year</option>
<?php
$sql=mysql_query("SELECT *FROM years");
if ($sql) {
$i=1;
while ($d=mysql_fetch_array($sql)) {
echo "<option value='{$d['y_id']}'>".$d['year']."</option>";
$i++;}
}
?>
</select>         
<span class=dept style="display:inline-block;"></span>
<span class=classes style="display:inline-block;"></span>
<span class=courses style="display:inline-block;"></span>
<span class=seting style="display:in-line-block;"></span>
</div>
</div>
</form>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
$(".yid").change(function(){
//alert($(this).val())
//send the request to the file holding class information
$(".dept").load("./dep_info.php?yid=" + $(".yid").val() );
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".dept").change(function(){
//alert($(".depta").val())
//send the request to the file holding class information
$(".classes").load("./classe_info.php?deptid=" + $(".depta").val() );
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".dept").change(function(){
//alert($(".depta").val())
//send the request to the file holding class information
$(".classes").load("./classe_info.php?deptid=" + $(".depta").val() );
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".classes").change(function(){
//alert($(".clas").val())
//send the request to the file holding class information
$(".courses").load("./caurse_info.php?clasid=" + $(".clas").val() );
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".courses").change(function(){
//alert($(".clas").val())
//send the request to the file holding class information
$(".seting").load("./student_in_setting.php?clasid=" + $(".clas").val() );
});
});
</script>
<?php
if (isset($_POST['save'])) {
$y=$_POST['yid'];
//searching the year id
//ending to find year id
$cor=$_POST['courid'];
foreach ($_POST as $key => $value) {
//$max=mysql_query("SELECT *FROM caurses");
//$maxrow=mysql_fetch_array($max);
//$cat_max=$maxrow['cat_max'];$exam_max=$maxrow['ex_marks'];
//ending to finding max
if(!is_numeric($key)){
continue;
}
//$type = substr($key,(strlen($key) - 1));
//finding fields
/*$fld = $type == 1?"cat_marks":"exams_marks";
fing the student id
$id = substr($key,0,(strlen($key) - 1));*/
//check if the student has any marks registered of the current course in the term in the current year
$id = substr($key,0,(strlen($key) - 1));
$check = mysql_query($q="SELECT * FROM setting WHERE s_id='{$id}' AND y_id='$y' AND markset='{$value}'") or die(mysql_error());
if(mysql_num_rows($check)>0){
$data = mysql_fetch_array($check);
$seid=$data['settingid'];
//echo "<script>alert('$seid')</script>";
mysql_query("UPDATE setting SET markset='{$value}' WHERE settingid='$seid'") or die(mysql_error());
} else{
//insert codes here
$insert=mysql_query($insert="INSERT INTO setting SET
settingid=null,
s_id='{$id}',
markset='{$value}',
y_id='{$y}',
c_id='$cor'") or die(mysql_error());
//}
}}
echo "inserted please";
}
?>