Advertisement
Guest User

Untitled

a guest
Jul 11th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.31 KB | None | 0 0
  1. <?php include('components/db-config.php'); ?>
  2.  
  3. <?php include('components/category-array-list.php'); ?>
  4.  
  5. <?php
  6.  
  7. $category = $_POST['category'];
  8.         var_dump($category);
  9.  
  10. switch($category){
  11.  
  12.  
  13.  
  14.     case "Desktops":
  15.         $name = $_POST['product_name'];
  16.         $price = $_POST['price'];
  17.         $desktops['Processor'] = $_POST['Processor'];
  18.         $desktops['Motherboard'] = $_POST['Motherboard'];
  19.         $desktops['Graphics Card'] = $_POST['Graphics_Card'];
  20.         $desktops['Storage'] = $_POST['Storage'];
  21.         $desktops['RAM'] = $_POST['RAM'];
  22.         $desktops['Video Interface'] = $_POST['Video_Interface'];
  23.         $desktops['Sound'] = $_POST['Sound'];
  24.         $desktops['Ethernet'] = $_POST['Ethernet'];
  25.         $desktops['USB'] = $_POST['USB'];
  26.         $desktops['Optical Drive'] = $_POST['Optical_Drive'];
  27.         $desktops['OS'] = $_POST['OS'];
  28.  
  29.         $thumbnail = $_POST['thumbnail'];
  30.  
  31.  
  32.  
  33.         $product_gallery = explode(",", $_POST['product_gallery']);
  34.         $product_gallery = serialize($product_gallery);
  35.  
  36.         $description = serialize($desktops);
  37.  
  38.         $stmt = $db->prepare("INSERT INTO products (product_name, product_description, product_price, product_category, thumbnail, product_gallery)
  39.                             VALUES (?, ?, ?, ?, ?, ?)");
  40.         $stmt->execute(array($name, $description, $price, $category, $thumbnail, $product_gallery));
  41.         break;
  42.     case "Laptops":
  43.         $name = $_POST['product_name'];
  44.         $price = $_POST['price'];
  45.         $laptops['Processor'] = $_POST['Processor'];
  46.         $laptops['Motherboard'] = $_POST['Motherboard'];
  47.         $laptops['Graphics Card'] = $_POST['Graphics_Card'];
  48.         $laptops['Storage'] = $_POST['Storage'];
  49.         $laptops['RAM'] = $_POST['RAM'];
  50.         $laptops['Video Interface'] = $_POST['Video_Interface'];
  51.         $laptops['Sound'] = $_POST['Sound'];
  52.         $laptops['Ethernet'] = $_POST['Ethernet'];
  53.         $laptops['USB'] = $_POST['USB'];
  54.         $laptops['Optical Drive'] = $_POST['Optical_Drive'];
  55.         $laptops['OS'] = $_POST['OS'];
  56.  
  57.         $thumbnail = $_POST['thumbnail'];
  58.  
  59.  
  60.  
  61.         $product_gallery = explode(",", $_POST['product_gallery']);
  62.         $product_gallery = serialize($product_gallery);
  63.  
  64.         $description = serialize($laptops);
  65.  
  66.         $stmt = $db->prepare("INSERT INTO products (product_name, product_description, product_price, product_category, thumbnail, product_gallery)
  67.                             VALUES (?, ?, ?, ?, ?, ?)");
  68.         $stmt->execute(array($name, $description, $price, $category, $thumbnail, $product_gallery));
  69. }
  70.  
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement