-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmen_product.php
More file actions
98 lines (94 loc) · 3.36 KB
/
men_product.php
File metadata and controls
98 lines (94 loc) · 3.36 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
include('connection.php');
if(isset($_POST['register_submit'])) {
$name = mysqli_real_escape_string($connection, $_POST['name']);
$cost = mysqli_real_escape_string($connection, $_POST['cost']);
$description = mysqli_real_escape_string($connection, $_POST['description']);
$photo1 = mysqli_real_escape_string($connection, $_POST['photo1']);
$photo2 = mysqli_real_escape_string($connection, $_POST['photo2']);
// Validation
if(!is_numeric($cost) || $cost <= 0) {
echo "<script>alert('Please enter a valid cost.');</script>";
} else {
$query = "INSERT INTO men_product VALUES (null, '$name', '$cost', '$description', '$photo1', '$photo2')";
$query_run = mysqli_query($connection, $query);
if($query_run) {
echo "<script>alert('Uploaded successfully');</script>";
header("Location: b_home.php");
exit();
} else {
echo "<script>alert('Error in uploading product');</script>";
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register</title>
<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=Poppins&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.min.css">
<link rel="icon" href="">
<link rel="stylesheet" href="login.css">
</head>
<style>
.bottom{
position: fixed;
bottom: 0;
left: 0;
width: 100%; /* Make sure the div spans the entire width of the viewport */
background-color: #f8f8f8; /* Example background color */
padding: 10px; /* Add padding for better visibility */
text-align: center; /* Center-align the text within the div */
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
background-color: black;
color: white;
}
input[type='submit']{
margin: 7px;
width: 300px;
background-color: black;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
}
textarea{
margin: 7px;
width: 300px;
padding: 10px;
margin-bottom: 10px;
border: 1px solid black;
border-radius: 4px;
box-sizing: border-box;
}
</style>
<body>
<div class="section">
<h1>Upload Your Product</h1>
<br>
<br>
<form action="" method="post">
<input type="text" id="name" name="name" placeholder="PRODUCT TITLE" required>
<br>
<input type="number" id="cost" name="cost" placeholder="PRODUCT COST" required>
<br>
<textarea name="description" id="description" cols="43" rows="5" placeholder="DESCRIPTION"></textarea>
<br>
<input type="text" id="photo1" name="photo1" placeholder="ADDRESS OF PHOTO 1" required>
<br>
<input type="text" id="photo2" name="photo2" placeholder="ADDRESS OF PHOTO 2" required>
<br>
<input type="submit" name="register_submit" value="Upload">
</form>
</div>
<div class="bottom">
<p>© Vintique 2023 All Rights Reserved.</p>
</div>
</body>
</html>