-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateProject.php
More file actions
36 lines (33 loc) · 1012 Bytes
/
CreateProject.php
File metadata and controls
36 lines (33 loc) · 1012 Bytes
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
<?php
/**
* Created by PhpStorm.
* User: e567802
* Date: 6/27/2017
* Time: 13:19
*/
require "Define.php";
$Project_Name = $_POST["Project_Name"];
if ($Project_Name == null) {
# echo "please input a project name";
header("refresh:2;url=SubmitProject.php");
print("please input a project name");
exit;
}
$Check_Project = "select * from project where Project_Name = '$Project_Name' ";
$SQL_Check = mysqli_query($dbc, $Check_Project);
if (mysqli_num_rows($SQL_Check) > 0) {
header("refresh:2;url=SubmitProject.php");
echo "This project already existed.";
exit;
}
else {
$Insert_Project = "INSERT INTO `project`(`Project_Name`) VALUES ('$Project_Name')";
if (!mysqli_query($dbc, $Insert_Project)) {
printf ("Error Message: %s\n", mysqli_error($dbc));
mysqli_close($dbc);
exit;
}
}
mysqli_close($dbc);
header("refresh:0;url=SelectProject.php");
?>