-
Notifications
You must be signed in to change notification settings - Fork 0
/
edititems.php
83 lines (77 loc) · 2.99 KB
/
edititems.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
include "condb.php";
$id = $_GET['id'];
$sql = "select *from product where id = $id";
$result = mysqli_query($con,$sql);
$row = mysqli_fetch_array($result);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<title>DesignX</title>
</head>
<?php
include "condb.php";
if(isset($_POST['submit'])){
$name = $_POST['name'];
$description= $_POST['description'];
$img = $_POST['img'];
$price = $_POST['price'];
$color = $_POST['color'];
$size = $_POST['size'];
$sql = "update product set name='$name',description='$description',img='$img',price='$price',color='$color',size='$size' where id = $id";
$result = mysqli_query($con,$sql);
if($result){
header("location:additems.php?id=$id");
}else{
echo "Items not edited !!!";
}
}
?>
<body>
<section class="updatesection"></section>
<div class="center" style="">
<h1>Edit Items</h1>
<form method="POST">
<div class="txt_field">
<input type="text" name="name" value="<?php echo $row['name']; ?>" required>
<span></span>
<label>ProductName</label>
</div>
<div class="txt_field">
<input type="text" name="description" value="<?php echo $row['description']; ?>" required>
<span></span>
<label>ProductDescription</label>
</div>
<div class="txt_field">
<input type="file" name="img" id="fileToUpload" value="<?php echo $row['img']; ?>"required>
<span></span>
<label>ProductImage</label>
</div>
<div class="txt_field">
<input type="number" name="price" value="<?php echo $row['price']; ?>" required>
<span></span>
<label>ProductPrice</label>
</div>
<div class="txt_field">
<input type="text" name="color" value="<?php echo $row['color']; ?>"required>
<span></span>
<label>ProductColors</label>
</div>
<div class="txt_field">
<input type="text" name="size" value="<?php echo $row['size']; ?>" required>
<span></span>
<label>ProductSizes</label>
</div>
<input type="submit" class="submit" name="submit" value="Update">
</form>
</div>
</body>
</html>