</label> <input type="submit" name="submit" value="Upload!" /> </p> </form> <?php if (isset($_POST['submit'])) { $name = $_FILES['file']['name']; $temp = $_FILES['file']['tmp_name']; $ttitle = $_POST["Title"]; // $pprice = $_POST["Price"]; require 'functions.php'; $fileexit = isfileexit($name, "brands", $conn); if (!$fileexit) { move_uploaded_file($temp, "brands/" . $name); $url = "http://sudan.besaba.com/brands/{$name}"; mysqli_query($conn, "INSERT INTO `brands` VALUE ('','{$name}','{$url}','{$ttitle}')"); echo "<br />" . $name . " has been uploaded"; header("Location: brands.php"); unset($_POST); require_once 'brandsjson.php'; // update the json file (brandsjson.txt) } } $query = mysqli_query($conn, "SELECT * FROM `brands`"); echo "<table width='160' border='1' align='center'>"; while ($row = mysqli_fetch_assoc($query)) { $id = $row['id'];
<?php // if(isset($_GET['id'])) // { // $brand_id = $_GET['id']; // } // else { // $brand_id = 8; } if (isset($_POST['submit'])) { $name = $_FILES['file']['name']; $temp = $_FILES['file']['tmp_name']; $ttitle = $_POST["Title"]; $pprice = $_POST["Price"]; echo $ttitle . "and " . $pprice; require 'functions.php'; $fileexit = isfileexit($name, "products", $conn); // if (!$fileexit) if (true) { move_uploaded_file($temp, "products/" . $name); $url = "http://sudan.besaba.com/products/{$name}"; mysqli_query($conn, "INSERT INTO `products` VALUE ('',{$brand_id},'{$name}','{$url}','{$ttitle}','{$pprice}')"); echo "<br />" . $name . " has been uploaded"; // header("Location: products.php"); // unset($_POST); require_once 'productsjson.php'; // update the json file (productsjson.txt) } } //////// if come from brand //////////////////// if (isset($_GET['id'])) { $brand_id = $_GET["id"];
insert new product detail images <input type="file" name="file" /> <input type="submit" name="submit_image" value="Upload!" /> </p> </form> <?php /////////////////////////// submit_image /////////////////////////////// if (isset($_POST['submit_image'])) { $name = $_FILES['file']['name']; $temp = $_FILES['file']['tmp_name']; // $ttitle =$_POST["Title"]; // $pprice = $_POST["Price"]; // echo $ttitle. "and ".$pprice; require 'functions.php'; $fileexit = isfileexit($name, "detailimages", $conn); if (!$fileexit) { move_uploaded_file($temp, "details/" . $name); $url = "http://sudan.besaba.com/details/{$name}"; mysqli_query($conn, "INSERT INTO `detailimages` VALUE ('','{$product_id}','{$name}','{$url}')"); echo "<br />" . $name . " has been uploaded"; // header("Location: details.php"); // unset($_POST); // require_once('detailimagesjson.php'); // update the json file (detailimagesjson.txt) } } /////////////////////////// end of submit_image ///////////////////////////////// /////////////////////////// submit details title description price size ///////////// if (isset($_POST['submit'])) { $title = $_POST['title']; $description = $_POST['description'];
<label for="Price">Price <input type="text" name="Price" id="Price"> </label> <input type="submit" name="submit" value="Upload!" /> </p> </form> <?php if (isset($_POST['submit'])) { $name = $_FILES['file']['name']; $temp = $_FILES['file']['tmp_name']; $ttitle = $_POST["Title"]; $pprice = $_POST["Price"]; require 'functions.php'; $fileexit = isfileexit($name, "brands"); if (!fileexit) { move_uploaded_file($temp, "brands/" . $name); $url = "http://localhost/brands/{$name}"; mysqli_query($conn, "INSERT INTO `brands` VALUE ('','{$name}','{$url}','{$ttitle}','{$pprice}')"); echo "<br />" . $name . " has been uploaded"; header("Location: brands.php"); unset($_POST); } } $query = mysqli_query($conn, "SELECT * FROM `brands`"); echo "<table width='160' border='1' align='center'>"; while ($row = mysqli_fetch_assoc($query)) { $id = $row['id']; $name = $row['name']; $url = "http://localhost/brands/" . $name;