-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd.php
More file actions
77 lines (60 loc) · 1.72 KB
/
Copy pathadd.php
File metadata and controls
77 lines (60 loc) · 1.72 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
<?php
//include auth_session.php file on all user panel pages
include("../../auth/auth_session.php");
?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Slider Record</title>
<style type="text/css">
.container{
background-color: grey;
padding: 10px;
}
input[type=submit]{
background-color:#3636c3;
border:none;
padding:5px;
cursor: pointer;
color: white;
}
input[type=submit]:hover{
background-color:blue;
}
</style>
</head>
<body>
<a href="../dashboard.php"> Dashboard</a><br>
<a href="index.php"> Back</a>
<div class="container">
<h1>Add Team</h1>
<form method="POST" enctype="multipart/form-data">
<label>Title</label><br>
<input type="text" name="title" required placeholder="Please enter your title"><br>
<label>Image</label><br>
<input type="file" name="image_from_form" required><br>
<label>Description</label><br>
<textarea name="description" cols="50" rows="10" required>
</textarea>
<br>
<input type="submit" name="submit" value="SUBMIT">
</form>
</div>
<?php
if (isset($_POST['submit'])) {
$title = $_POST['title'];
$description = $_POST['description'];
$filename = $_FILES["image_from_form"]["name"];
$tempname = $_FILES["image_from_form"]["tmp_name"];
$folder = "../../image/team/" . $filename;
include("../../config/db_config.php");
$insert = mysqli_query($connection, "INSERT INTO team(title, description, image, created_at) VALUES ('$title', '$description', '$filename',current_timestamp())");
move_uploaded_file($tempname, $folder);
if ($insert) {
header('Location:index.php');
}
}
?>
</body>
</html>