Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('../db.php');
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
- <head>
- <title>Insert Product</title>
- <script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
- <script>tinymce.init({selector:'textarea'});</script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
- <style type="text/css">
- body {
- background-color: #abd9fa;
- }
- </style>
- </head>
- <body>
- <form action="insert_product.php" method="post" enctype="multipart/form-data">
- <table align="center" width="750" border="1">
- <tr align="center">
- <td colspan="8"><h2>Add New Product</h2>
- </td>
- </tr>
- <tr>
- <td align="right"><b>Name:</b></td>
- <td><input type="text" name="product_title"/></td>
- </tr>
- <tr>
- <td align="right"><b>Category:</b></td>
- <td><select name="product_cat_id"><option>Select Category</option></select></td>
- <?php
- function getCat() {
- global $con;
- $get_cat = "select * from magazin";
- $run_cat = mysqli_query($con, $get_cat_id);
- while ($row_cat=mysqli_fetch_array($run_cat_id)) {
- $cat_id = $row_cat['cat_id'];
- $cat_title = $row_cat['cat_title'];
- echo "<option>$cat_title</option>";
- }
- }
- ?>
- </tr>
- <tr>
- <td align="right"><b>Storage:</b></td>
- <td><input type="text" name="product_storage" /></td>
- </tr>
- <tr>
- <td align="right"><b>Price:</b></td>
- <td><input type="text" name="product_price" /></td>
- </tr>
- <tr>
- <td align="right"><b>Image:</b></td>
- <td><input type="file" name="product_image" /></td>
- </tr>
- <tr>
- <td align="right"><b>Description:</b></td>
- <td><textarea name="product_desc" cols="30" rows="10"></textarea></td>
- </tr>
- <tr align="center">
- <td colspan="8"><input type="submit" name="insert_post" value="Insert Now"/></td>
- </tr>
- </table>
- </form>
- <?php
- if(isset($_POST['insert_post'])){
- $product_name = $_POST['product_title'];
- $product_iphone = $_POST['product_iphone'];
- $product_ipod = $_POST['product_ipod'];
- $product_ipad = $_POST['product_ipad'];
- $product_casti = $_POST['product_casti'];
- $product_huse = $_POST['product_huse'];
- $product_incarcatoare = $_POST['product_incarcatoare'];
- $product_storage = $_POST['product_storage'];
- $product_price = $_POST['product_price'];
- $product_desc = $_POST['product_description'];
- /*
- //getting the image from the field
- $product_image = $_FILES['product_image'] ['name'];
- $product_image_tmp = $_FILES['product_image'] ['temp_name'];
- 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')";
- $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')";
- $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')";
- $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')";
- $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')";
- $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')";
- */
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement