Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include('components/db-config.php'); ?>
- <?php include('components/category-array-list.php'); ?>
- <?php
- $category = $_POST['category'];
- var_dump($category);
- switch($category){
- case "Desktops":
- $name = $_POST['product_name'];
- $price = $_POST['price'];
- $desktops['Processor'] = $_POST['Processor'];
- $desktops['Motherboard'] = $_POST['Motherboard'];
- $desktops['Graphics Card'] = $_POST['Graphics_Card'];
- $desktops['Storage'] = $_POST['Storage'];
- $desktops['RAM'] = $_POST['RAM'];
- $desktops['Video Interface'] = $_POST['Video_Interface'];
- $desktops['Sound'] = $_POST['Sound'];
- $desktops['Ethernet'] = $_POST['Ethernet'];
- $desktops['USB'] = $_POST['USB'];
- $desktops['Optical Drive'] = $_POST['Optical_Drive'];
- $desktops['OS'] = $_POST['OS'];
- $thumbnail = $_POST['thumbnail'];
- $product_gallery = explode(",", $_POST['product_gallery']);
- $product_gallery = serialize($product_gallery);
- $description = serialize($desktops);
- $stmt = $db->prepare("INSERT INTO products (product_name, product_description, product_price, product_category, thumbnail, product_gallery)
- VALUES (?, ?, ?, ?, ?, ?)");
- $stmt->execute(array($name, $description, $price, $category, $thumbnail, $product_gallery));
- break;
- case "Laptops":
- $name = $_POST['product_name'];
- $price = $_POST['price'];
- $laptops['Processor'] = $_POST['Processor'];
- $laptops['Motherboard'] = $_POST['Motherboard'];
- $laptops['Graphics Card'] = $_POST['Graphics_Card'];
- $laptops['Storage'] = $_POST['Storage'];
- $laptops['RAM'] = $_POST['RAM'];
- $laptops['Video Interface'] = $_POST['Video_Interface'];
- $laptops['Sound'] = $_POST['Sound'];
- $laptops['Ethernet'] = $_POST['Ethernet'];
- $laptops['USB'] = $_POST['USB'];
- $laptops['Optical Drive'] = $_POST['Optical_Drive'];
- $laptops['OS'] = $_POST['OS'];
- $thumbnail = $_POST['thumbnail'];
- $product_gallery = explode(",", $_POST['product_gallery']);
- $product_gallery = serialize($product_gallery);
- $description = serialize($laptops);
- $stmt = $db->prepare("INSERT INTO products (product_name, product_description, product_price, product_category, thumbnail, product_gallery)
- VALUES (?, ?, ?, ?, ?, ?)");
- $stmt->execute(array($name, $description, $price, $category, $thumbnail, $product_gallery));
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement