MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.68
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/imyrqtmy/public_html/lashadesigns/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/lashadesigns/add_to_cart.php
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

include("admin/includes/config.php");
session_start();

if ($_SERVER["REQUEST_METHOD"] == "POST") {
 
$se = $_SESSION["id"];

if (!isset($_SESSION['id'])) {
    header("Location: login.php");
    exit();
}

    $user_id = $_SESSION['id'];
    $product_id = $_POST['product_id'];
    $product_name = $_POST['name'];
    $price = $_POST['price'];
    $color = $_POST['color'];
    $size = $_POST['size'];
    $qty = $_POST['quantity'];
    $photo = $_POST['photo']; // 👈 New field

    $total = $price * $qty;

    $stmt = $conn->prepare("INSERT INTO cart (user_id, product_id, name, color, size, price, quantity, total, photo) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
    $stmt->bind_param("iisssdids", $user_id, $product_id, $product_name, $color, $size, $price, $qty, $total, $photo);

    if ($stmt->execute()) {
        echo "success";
    } else {
        echo "error";
    }
}
?>

MMCT - 2023