-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtutor_mge_project_new.php
141 lines (116 loc) · 4.05 KB
/
tutor_mge_project_new.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
<?php include("session_start.php"); ?>
<?php include("tutor_authenticate.php"); ?>
<?php
// form submited code
if(isset($_POST['name']))
{
if($_POST['name'] == '')
{
$_SESSION['msg'] = 'Please enter project name.';
header('Location: tutor_mge_project_new.php');
exit;
}
include('db_connection.php');
//echo '<br />Breaked 1<br />';
//break;
//echo '<br />Breaked 2<br />';
//exit;
$sql = 'INSERT INTO project VALUES ( ' . $_SESSION['tutor_id'] . ', ' .
($_POST['supervisor_id'] == '' ? 'NULL' : $_POST['supervisor_id']) . ', ' .
($_POST['student_id'] == '' ? 'NULL' : $_POST['student_id']) . ", NULL , '" .
$_POST['name'] . "', '" .
$_POST['start_date'] . "', '" . $_POST['first_review_date'] . "', '" .
$_POST['second_review_date'] . "', '" . $_POST['submission_date'] .
"', NULL, NULL, NULL, NULL, NULL, NULL, NULL);";
//echo '<br />sql = ' . $sql . '<br />';
//exit;
if(!mysql_query($sql))
{
if(mysql_errno() == 1062) // rec exists
{
//print 'Record already exists for "' . $_REQUEST['txtFullName'] . '"';
$_SESSION['msg'] = 'Record already exists with name: ' . $_POST['name'];
}
else
{
$_SESSION['msg'] = mysql_errno() . '<br />Error: ' . mysql_error();
}
} // if(!mysql_query($sql))
else
{
$_SESSION['msg'] = $_POST['name'] . "'s record created successfully.";
}
header('Location: tutor_mge_project_main.php');
exit;
//mysql_close($con);
//echo "<br>end";
}
?>
<?php include("top.php"); ?>
<?php include("tutor_submenu.php"); ?>
<div id="contenttext">
<div style="padding:10px">
<span class="titletext">New Project</span> </div>
<div class="bodytext" style="padding:12px;" align="justify">
<strong>New Project</strong>
<p>Here we will add new Project.</p>
<script type="text/javascript" language="javascript" src="js/cal2.js"></script>
<table align="center" border="1">
<form action="tutor_mge_project_new.php" method="post" name="frm">
<tr><td>Supervisor:</td>
<td><select name="supervisor_id">
<option value="">------------------------------</option>
<?php
include('db_connection.php');
$sql = 'SELECT * FROM supervisor ORDER BY name;';
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
echo '<option value="' . $row['supervisor_id'] . '">' . $row['name'] . '</option>';
}
?>
</select></td></tr>
<tr><td>Student: </td>
<td><select name="student_id">
<option value="">------------------------------</option>
<?php
include('db_connection.php');
$sql = 'SELECT * FROM student ORDER BY name;';
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
echo '<option value="' . $row['student_id'] . '">' . $row['name'] . '</option>';
}
?>
</select></td></tr>
<tr><td>Name:</td><td><input type="text" name="name" /></td></tr>
<tr><td>Start Date:</td><td>
<input type="text" name="start_date" title="Format: yyyy-mm-dd" />
<a href="javascript:showCal('start_date')" title="Click here to select date">
<img src="images/calender.jpg" width="22" height="21" border="0" /></a>
</td></tr>
<tr><td>First Review Date:</td><td>
<input type="text" name="first_review_date" title="Format: yyyy-mm-dd" />
<a href="javascript:showCal('first_review_date')" title="Click here to select date">
<img src="images/calender.jpg" width="22" height="21" border="0" /></a>
</td></tr>
<tr><td>Second Review Date:</td><td>
<input type="text" name="second_review_date" title="Format: yyyy-mm-dd" />
<a href="javascript:showCal('second_review_date')" title="Click here to select date">
<img src="images/calender.jpg" width="22" height="21" border="0" /></a>
</td></tr>
<tr><td>Submission Date:</td><td>
<input type="text" name="submission_date" title="Format: yyyy-mm-dd" />
<a href="javascript:showCal('submission_date')" title="Click here to select date">
<img src="images/calender.jpg" width="22" height="21" border="0" /></a>
</td></tr>
<tr><td align="center"> <input type="button" value="Back" onclick="location.href = 'tutor_mge_project_main.php';"/>
</td><td align="center" />
<input type="submit" value="Create" />
<input type="reset" />
</td></tr>
</form>
</table>
</div>
</div>
<?php include("bottom.php"); ?>