forked from sharmakeshav1030/EventManagementWebsite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.php
59 lines (33 loc) · 1.24 KB
/
upload.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
<?php
$servername = "localhost";
$username = "id13212736_root";
$password = "Team2internship@1";
$dbname = "id13212736_event";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if(isset($_POST['submit_image']))
{
$eventtitle = $_POST['eventtitle'];
$sql = "select category, organizer_name, startdate from create_event where event_title='$eventtitle'";
$result = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($result)) {
$category = $row['category'];
$startdate = $row['startdate'];
$orgname = $row['organizer_name'];
}
for($i=0;$i<count($_FILES["files"]["name"]);$i++)
{
$uploadfile=$_FILES["files"]["tmp_name"][$i];
$folder="gallery/";
move_uploaded_file($_FILES["files"]["tmp_name"][$i], "$folder".$_FILES["files"]["name"][$i]);
$image=basename( $_FILES["files"]["name"][$i]);
$sql1 = "insert into gallery(event_name, organizer_name, image, date,category) values ('$eventtitle','$orgname','$image', '$startdate','$category')";
$result1 = mysqli_query($conn, $sql1);
header('location: dashboard.php');
}
}
?>