-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupload_product.php
53 lines (47 loc) · 2.51 KB
/
upload_product.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
<?php
// Include your database connection code here
include 'db_connection.php';
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Retrieve data from the form
$title = $_POST['title'];
$description = $_POST['description'];
$category = $_POST['category'];
$price_mrp = $_POST['price_mrp'];
$price_list = $_POST['price_list'];
$thumbnail_image = $_POST['thumbnail'];
$product_images = $_POST['images'];
$reviews = $_POST['reviews'];
$ratings = $_POST['ratings'];
$colour_options = $_POST['variants'];
$materials = $_POST['materials'];
$display = $_POST['display'];
$connectivity = $_POST['connectivity'];
$battery_life = $_POST['battery_life'];
$health_features = $_POST['health_fitness'];
$water_resistance = $_POST['water_resistance'];
$compatibility = $_POST['compatibility'];
$additional_features = $_POST['additional_features'];
$warranty_return = $_POST['warranty_return'];
$return_policy = $_POST['return_policy'];
$customer_reviews = $_POST['customer_reviews'];
$size_and_dimensions = $_POST['size_dimensions'];
$packaging = $_POST['packaging'];
$shipping_delivery = $_POST['shipping_delivery'];
// Prepare the SQL query
$query = "INSERT INTO wrist_watch_products (title, description, category, price_mrp, price_list, thumbnail_image, product_images, reviews, ratings, colour_options, materials, display, connectivity, battery_life, health_features, water_resistance, compatibility, additional_features, warranty, return_policy, customer_reviews, size_and_dimensions, packaging, shipping_delivery) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
// Prepare and bind the statement
$stmt = $conn->prepare($query);
$stmt->bind_param("ssssssssiisssssssssssssss", $title, $description, $category, $price_mrp, $price_list, $thumbnail_image, $product_images, $reviews, $ratings, $colour_options, $materials, $display, $connectivity, $battery_life, $health_features, $water_resistance, $compatibility, $additional_features, $warranty_return, $return_policy, $customer_reviews, $size_and_dimensions, $packaging, $shipping_delivery);
// Execute the statement
if ($stmt->execute()) {
echo "Product uploaded successfully!";
} else {
echo "Error uploading product: " . $stmt->error;
}
// Close the statement
$stmt->close();
// Close the database connection
$conn->close();
}
?>