-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathppost.php
61 lines (41 loc) · 1.17 KB
/
ppost.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
60
61
<?php
include_once('dbconnection.php');
$name = $_SESSION['Pass'];
if (isset($_POST['submit']))
{
$query = "SELECT * FROM `membership` WHERE UserName='$name';";
$result = mysqli_query($con, $query);
$row = mysqli_fetch_assoc($result);
if (mysqli_num_rows($result) > 0)
{
$email = $row['Email'];
$mobileNo = $row['MobileNo'];
}
$target = "Upload/" . basename($_FILES['my_image']['name']);
$image = $_FILES['my_image']['name'];
$Pname = $_POST['productname'];
$location = $_POST['Location'];
$price = $_POST['price'];
// $image = $_FILES['my_image'];
$query = "INSERT INTO `posts`(`Name`, `Email`, `Mobile`, `Price`, `location`, `image`, `Owner`)
VALUES ('$Pname','$email','$mobileNo','$price','$location','$image','$name');";
//upload image
if(move_uploaded_file($_FILES['image']['temp_name'],$target))
{
$msg = "image uploaded";
}
else
{
$msg = "there as no file";
}
$result = mysqli_query($con, $query);
if($result)
{
header("location:message.html");
}
echo $name;
echo $location;
echo $price;
// echo $image;
}
?>