-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit-course.php
166 lines (146 loc) · 7.13 KB
/
edit-course.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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
session_start();//Start new or resume existing session
error_reporting(0);//if error exists it ignore and doesnot show on screen
include('includes/config.php');// includes file as if that code is present here
if(strlen($_SESSION['login'])==0)//takes string from login and check the user enter coreect login details then he redirect to change password page otherwise goto index page
{
header('location:index.php');//if login details are wrong directs to the index file
}
else{
$id=intval($_GET['id']);//An associative array of variables passed to the current script via the URL parameters.
date_default_timezone_set('Asia/Kolkata');// change according timezone
$currentTime = date( 'd-m-Y h:i:s A', time () );//time is taken from internet or your pc
if(isset($_POST['submit']))
{
$coursecode=$_POST['coursecode'];//takes value of string and save in the coursecode
$coursename=$_POST['coursename'];
$sessionname=$_POST['sessionname'];
$semestername=$_POST['semestername'];
$ret=mysqli_query($con,"update student set courseCode='$coursecode',courseName='$coursename',sessionName='$sessionname',semesterName='$semestername' ,updationDate='$currentTime' where id='$id'");
if($ret)
{
$_SESSION['msg']="Course Updated Successfully !!";
}
else
{
$_SESSION['msg']="Error : Course not Updated";
}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" /><!--The charset attribute specifies the character encoding for the HTML document.-->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /><!--Fix the website according to the device-->
<meta name="description" content="" /><!-- show the description of wesite -->
<meta name="author" content="" /><!--show the name of author who create the website....such as Designed by Shivam-->
<title>student| enrollment| Course</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" /><!--fetch the style from web called as bootstrap-->
<link href="assets/css/font-awesome.css" rel="stylesheet" /><!-- decribe the font of website-->
<link href="assets/css/style.css" rel="stylesheet" />
</head>
<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['alogin']!="")//if teacher logins sucessfully
{
include('includes/menubar.php');//goes to menubar
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line"> Language Course </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Course
</div>
<font color="green" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo htmlentities($_SESSION['msg']="");?></font>
<div class="panel-body">
<form name="dept" method="post">
<?php
$sql=mysqli_query($con,"select * from student where id='$id'");
$cnt=1;
while($row=mysqli_fetch_array($sql))
{
$courseName = $row['courseName'];
$semesterName = $row['semesterName'];
?>
<p><b>Last Updated at</b> :<?php echo htmlentities($row['updationDate']);?></p><!--updationDate is converted into html tag-->
<div class="form-group">
<label for="coursecode">Course Code </label>
<span>:</span>
<select name="coursecode">
<?php
$result = mysqli_query($con, "SELECT * FROM courses");
while($row = mysqli_fetch_array($result)){
?>
<option value="<?php echo $row['courseName']." ".$row['courseCode'];?>"><?php echo $row['courseName']." ".$row['courseCode'];?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label for="coursename">Student Name </label>
<input type="text" class="form-control" id="coursename" name="coursename" value="<?php echo htmlentities($courseName);?>" required /><!--here required means this field is not empty-->
</div>
<div class="form-group">
<label for="sessionname">Session </label>
<!-- <input type="text" class="form-control" id="sessionname" name="sessionname" placeholder="Session Name" required /> -->
<select class="form-control" id="sessionname" name="sessionname">
<?php
$result = mysqli_query($con, "SELECT * FROM session");
while($row = mysqli_fetch_array($result)){
?>
<option value="<?php echo $row['session'];?>"><?php echo $row['session']." ".$row['courseCode'];?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label for="semestername">Semester </label>
<select class="form-control" id="sessionname" name="semestername">
<?php
$result = mysqli_query($con, "SELECT * FROM semester LIMIT 0, 2");
while($row = mysqli_fetch_array($result)){
?>
<option value="<?php echo $row['semester'];?>"><?php echo $row['semester']." ".$row['courseCode'];?></option>
<?php
}
?>
</select>
</div>
<!-- <div class="form-group">
<label for="seatlimit">Seat no </label>
<input type="text" class="form-control" id="seatlimit" name="seatlimit" placeholder="Seat no" required />
</div> -->
<?php } ?>
<button type="submit" name="submit" class="btn btn-default"><i class=" fa fa-refresh "></i> Update</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>