Example #1
0
    echo $_POST['Photo'];
    echo $_POST['productCat'];
    $fileName = $_FILES['Photo']['name'];
    $tmpName = $_FILES['Photo']['tmp_name'];
    $fileSize = $_FILES['Photo']['size'];
    $fileType = $_FILES['Photo']['type'];
    $filePath = $uploadDir . $fileName;
    $result = move_uploaded_file($tmpName, $filePath);
    if (!$result) {
        echo "Error uploading file";
        exit;
    }
    if (!get_magic_quotes_gpc()) {
        $fileName = addslashes($fileName);
        $filePath = addslashes($filePath);
    }
    $newProduct = new Product();
    $newProduct->productCatID = $_POST['productCat'];
    $newProduct->productQuantity = $_POST['quantity'];
    $newProduct->productPrice = $_POST['price'];
    $newProduct->productName = $_POST['productName'];
    $newProduct->productDesc = $_POST['productDesc'];
    $newProduct->filename = $fileName;
    $newProduct->Insert();
    header('location: managerproduct.php');
} else {
    //$arrayName = array('' => , );
    $productcat = array('1' => 1, '2' => 2, '3' => 3);
    $smarty->assign('productCat', $productcat);
    $smarty->display('addproduct.tpl');
}
<?php

require 'include/config.php';
require 'include/class.network.php';
require 'include/class.mailing.php';
if (isset($_POST['submit'])) {
    require 'include/class.product.php';
    $p = new Product($db);
    $as = array();
    foreach ($_POST['auto_subscribe_lists'] as $network => $list) {
        if ($list > 0) {
            $as[] = $list;
        }
    }
    $_POST['auto_subscribe_lists'] = join(",", $as);
    $p->Insert($_POST);
    Misc::Redirect('product_list.php');
}
include 'include/top.php';
?>

<form method="post">
	<p>
		<label><span>Title</span></label>
		<input type="text" name="title" id="title" placeholder="Enter product title" />
	</p>
	<p>
		<label><span>Description</span></label>
		<textarea name="description" id="description"></textarea>
	<p>
		<label><span>Earning</span></label>