-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsell.php
38 lines (27 loc) · 927 Bytes
/
sell.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
<?php
session_start();
$db = mysqli_connect("localhost", "root", "", "users");
$itemname=mysqli_real_escape_string($db,$_POST['itemname']);
$MobileNo=mysqli_real_escape_string($db,$_POST['MobileNo']);
$price=mysqli_real_escape_string($db,$_POST['price']);
$comment=mysqli_real_escape_string($db,$_POST['comment']);
$msg = "";
if (isset($_POST['submit']))
{
$image = $_FILES['image']['name'];
$target = "images/".basename($image);
echo ($target);
$sql = "INSERT INTO selldb (itemname,MobileNo,price,comment, image)
VALUES ('$itemname','$MobileNo','$price', '$comment','$image' )";
echo($sql);
mysqli_query($db, $sql);
if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
$msg = "Image uploaded successfully";
echo($msg);
}else{
$msg = "Failed to upload image";
echo($msg);
}
}
mysqli_close($db);
=======