-
Notifications
You must be signed in to change notification settings - Fork 0
/
organisationdisplay1.php
58 lines (50 loc) · 1.68 KB
/
organisationdisplay1.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
<html>
<head>
<title></title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="static/css/materialize.min.css" media="screen,projection"/>
<link rel="stylesheet" type="text/css" href="static/prelogin.css">
</head>
<style> .center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
</style>
<body>
<div class="a1" class="center">
<?php
session_start();
$msg ="";
//pressing upload button
if (isset($_POST['upload'])) {
$target = "uploads/".basename($_FILES['image']['name']);
//db connection
$db = mysqli_connect("localhost","root","","blooddonation");
//getting submitted datanfrom form
$image = $_FILES['image']['name'];
$text = $_POST['text'];
echo $_SESSION['user'];
$user=mysqli_real_escape_string($_SESSION['user']);
//$user = mysql_real_escape_string($_SESSION['user']);
$sql = "UPDATE organisationtable SET UpCamp='$image', UpCampText='$text'
WHERE Username ='".$_SESSION['user']."'";
//mysqli_query($db, $sql);//stores submitted data into database
//'" "'
if (!mysqli_query($db,$sql))
{
echo("Error description: " . mysqli_error($con));
}
//saving in folder
if (move_uploaded_file($_FILES['image']['tmp_name'],$target )) {
$msg="Image uploaded successfully";
}else{
$msg="There was a problem uploading this image";
}
}
header("Location: organisationdisplay.php");
?>
</div>