-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsection1.php
More file actions
171 lines (161 loc) · 6.67 KB
/
Copy pathsection1.php
File metadata and controls
171 lines (161 loc) · 6.67 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
ob_start();
session_start();
include_once 'dbconnEE.php';
if(isset($_SESSION['User_Name'])){
$admin = $_SESSION['User_Name'];
}
//if no existing session, user logged out
if(!isset($_SESSION['User_Name'])){
header("Location: indexEE.php");
return;
echo $_SESSION['User_Name'];
}
?>
<!DOCTYPE html>
<html>
<head>
<title> Section 1 </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<img src="greenwich.png" alt="logo" height="80" width="160">
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
<a class="navbar-brand" href="welcomeEE.php">EE home</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="editEE.php">View/Update profile</a></li>
<li><a href="updatePassEE.php">Update password</a></li>
<li><a href="expenses.php">Upload expense form</a></li>
<li><a href="logout.php">Log out</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<h5><b>Welcome, <?php echo $_SESSION ['User_Name'];?></b></h5>
<h5><b>YEAR: <?php echo $_SESSION ['year'];?></b></h5>
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<h4>Section 1</h4>
<form name="regForm" method="POST">
Overal experience:
<select class="form-control" name="title">
<option value="Very Good">Very Good</option>
<option value="Good">Good</option>
<option value="Normal">Normal</option>
<option value="Bad">Bad</option>
</select><br>
<p></p>
<div class="form-group">
<label for="comment">Additional commentary for internal school use:</label>
<textarea class="form-control" rows="5" name="comment"></textarea>
</div>
<p></p>
<label>Choose one of this:</label>
<label class="radio-inline"><input type="radio" name="optradio" value="YES">YES</label>
<label class="radio-inline"><input type="radio" name="optradio" value="NO">NO</label>
<p></p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Question</th>
<th>Choose one answer</th>
</tr>
</thead>
<tbody>
<tr>
<td>Why bla bla?</td>
<td>
<label class="radio-inline"><input type="radio" name="optradio1" value="Very Good">Very Good</label>
<label class="radio-inline"><input type="radio" name="optradio1" value="Good">Good</label>
<label class="radio-inline"><input type="radio" name="optradio1" value="Normal">Normal</label>
<label class="radio-inline"><input type="radio" name="optradio1" value="Bad">Bad</label>
</td>
</tr>
<tr>
<td>Who bla bla?</td>
<td>
<label class="radio-inline"><input type="radio" name="optradio2" value="Very Good">Very Good</label>
<label class="radio-inline"><input type="radio" name="optradio2" value="Good">Good</label>
<label class="radio-inline"><input type="radio" name="optradio2" value="Normal">Normal</label>
<label class="radio-inline"><input type="radio" name="optradio2" value="Bad">Bad</label>
</td>
</tr>
<tr>
<td>Where bla bla?</td>
<td>
<label class="radio-inline"><input type="radio" name="optradio3" value="Very Good">Very Good</label>
<label class="radio-inline"><input type="radio" name="optradio3" value="Good">Good</label>
<label class="radio-inline"><input type="radio" name="optradio3" value="Normal">Normal</label>
<label class="radio-inline"><input type="radio" name="optradio3" value="Bad">Bad</label>
</td>
</tr>
</tbody>
</table>
</div>
	 <input type="submit" class="btn btn-default" name="submit1" value="Submit"><br><br>
</form>
<?php
if(isset($_POST["submit1"])){
if(!isset($_SESSION['r_id'])){
$year = $_SESSION ['year'];
$user= $_SESSION ['User_Name'];
$title=strip_tags($_POST['title']);
$comment=strip_tags($_POST['comment']);
$optradio=strip_tags($_POST['optradio']);
$optradio1=strip_tags($_POST['optradio1']);
$optradio2=strip_tags($_POST['optradio2']);
$optradio3=strip_tags($_POST['optradio3']);
$query = "INSERT INTO final_report (report_id, year, User_Name, s1_1, s1_2, s1_3, s1_4, s1_5, s1_6,Start) VALUES (null,'$year','$user','$title','$comment','$optradio','$optradio1','$optradio2','$optradio3',now());";
if(mysqli_query($conn, $query)){
$last_id = mysqli_insert_id($conn);
$_SESSION['last_id'] = $last_id;
echo "Good job!";
$_SESSION['year']=$year;
header( "Location: section2.php" );
}
}else{
$year = $_SESSION ['year'];
$user= $_SESSION ['User_Name'];
$title=strip_tags($_POST['title']);
$comment=strip_tags($_POST['comment']);
$optradio=strip_tags($_POST['optradio']);
$optradio1=strip_tags($_POST['optradio1']);
$optradio2=strip_tags($_POST['optradio2']);
$optradio3=strip_tags($_POST['optradio3']);
$query = "UPDATE final_report SET s1_1 = '$title', s1_2 = '$comment', s1_3 = '$optradio', s1_4='$optradio1', s1_5='$optradio2', s1_6='$optradio' WHERE year = '$year' AND User_Name = '$user';";
mysqli_query($conn, $query);
header( "Location: section2.php" );
}
}
?>
</div>
</div>
</div>
</div>
</body>
</html>