-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert.php
52 lines (34 loc) · 1.22 KB
/
insert.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
<?php
include('assets/server/connection.php');
if(isset($_POST['submit'])){
$pname=$_POST['pname'];
$pdes=$_POST['pdes'];
$fname=$_FILES['file']['name'];
$tname=$_FILES['file']['tmp_name'];
move_uploaded_file($tname,'./pdf/'.$fname);
$psd=$_POST['psd'];
$deadline=$_POST['deadline'];
$pmname=$_POST['pmname'];
$pdname=$_POST['pdname'];
$status=$_POST['status'];
echo $pmname;
echo $status;
$dup_no = mysqli_query($conn,"SELECT * FROM `projects` WHERE pname = '$pname'");
// $dup_email = mysqli_query($conn,"SELECT * FROM `users` WHERE user_email= '$email'");
if(mysqli_num_rows($dup_no)){
echo"
<script>
alert('This project is already added');
window.location.href='add.php';
</script>";
}
else{
@ mysqli_query($conn,"INSERT INTO `projects` ( `pname`, `pdes`, `pdf`, `psd`, `deadline`, `pmname`, `pdname`, `status`) VALUES ('$pname', '$pdes', '$fname', '$psd', '$deadline', '$pmname', '$pdname', '$status')");
echo " <script>
alert(' registered successfully');
window.location.href='view.php';
</script>";
}
}
?>
?>