Advertisement
Guest User

ddddd

a guest
May 4th, 2015
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.43 KB | None | 0 0
  1. <?php
  2. include('../db.php');
  3. ?>
  4.  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
  7. <head>
  8. <title>Insert Product</title>
  9.  
  10. <script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
  11. <script>tinymce.init({selector:'textarea'});</script>
  12.  
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  14. <link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
  15. <style type="text/css">
  16. body {
  17. background-color: #abd9fa;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <form action="insert_product.php" method="post" enctype="multipart/form-data">
  23.  
  24. <table align="center" width="750" border="1">
  25.  
  26. <tr align="center">
  27. <td colspan="8"><h2>Add New Product</h2>
  28. </td>
  29. </tr>
  30.  
  31.  
  32. <tr>
  33. <td align="right"><b>Name:</b></td>
  34. <td><input type="text" name="product_title"/></td>
  35. </tr>
  36.  
  37.  
  38. <tr>
  39. <td align="right"><b>Category:</b></td>
  40. <td><select name="product_cat_id"><option>Select Category</option></select></td>
  41. <?php
  42.  
  43. function getCat() {
  44. global $con;
  45.  
  46. $get_cat = "select * from magazin";
  47.  
  48. $run_cat = mysqli_query($con, $get_cat_id);
  49.  
  50. while ($row_cat=mysqli_fetch_array($run_cat_id)) {
  51.  
  52. $cat_id = $row_cat['cat_id'];
  53. $cat_title = $row_cat['cat_title'];
  54. echo "<option>$cat_title</option>";
  55.  
  56. }
  57. }
  58. ?>
  59.  
  60. </tr>
  61.  
  62. <tr>
  63. <td align="right"><b>Storage:</b></td>
  64. <td><input type="text" name="product_storage" /></td>
  65. </tr>
  66.  
  67. <tr>
  68. <td align="right"><b>Price:</b></td>
  69. <td><input type="text" name="product_price" /></td>
  70. </tr>
  71.  
  72. <tr>
  73. <td align="right"><b>Image:</b></td>
  74. <td><input type="file" name="product_image" /></td>
  75. </tr>
  76.  
  77. <tr>
  78. <td align="right"><b>Description:</b></td>
  79. <td><textarea name="product_desc" cols="30" rows="10"></textarea></td>
  80. </tr>
  81.  
  82. <tr align="center">
  83. <td colspan="8"><input type="submit" name="insert_post" value="Insert Now"/></td>
  84. </tr>
  85.  
  86.  
  87. </table>
  88. </form>
  89.  
  90.  
  91. <?php
  92.  
  93.  
  94. if(isset($_POST['insert_post'])){
  95.  
  96.  
  97.  
  98. $product_name = $_POST['product_title'];
  99. $product_iphone = $_POST['product_iphone'];
  100. $product_ipod = $_POST['product_ipod'];
  101. $product_ipad = $_POST['product_ipad'];
  102. $product_casti = $_POST['product_casti'];
  103. $product_huse = $_POST['product_huse'];
  104. $product_incarcatoare = $_POST['product_incarcatoare'];
  105. $product_storage = $_POST['product_storage'];
  106. $product_price = $_POST['product_price'];
  107. $product_desc = $_POST['product_description'];
  108.  
  109.  
  110. /*
  111. //getting the image from the field
  112. $product_image = $_FILES['product_image'] ['name'];
  113. $product_image_tmp = $_FILES['product_image'] ['temp_name'];
  114.  
  115. echo $insert_product = "insert into ipod (product_name,product_color,product_storage,product_price,product_image,product_description) values ('$product_name','$product_cat','$product_storage','$product_price','$product_desc','$product_image')";
  116. $insert_product = "insert into iphone (product_name,product_color,product_storage,product_price,product_image,product_description) values ('$product_name','$product_cat','$product_storage','$product_price','$product_desc','$product_image')";
  117. $insert_product = "insert into ipad (product_name,product_color,product_storage,product_price,product_image,product_description) values ('$product_name','$product_cat','$product_storage','$product_price','$product_desc','$product_image')";
  118. $insert_product = "insert into incarcatoare (product_name,product_price,product_image,product_description) values ('$product_name','$product_cat','$product_storage','$product_price','$product_desc','$product_image')";
  119. $insert_product = "insert into huse (product_name,product_price,product_image,product_description) values ('$product_name','$product_cat','$product_storage','$product_price','$product_desc','$product_image')";
  120. $insert_product = "insert into casti (product_name,product_price,product_image,product_description) values ('$product_name','$product_cat','$product_storage','$product_price','$product_desc','$product_image')";
  121. */
  122. }
  123.  
  124.  
  125.  
  126. ?>
  127.  
  128. </body>
  129. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement