<?php

require_once './function_defination.php';
echo '<pre>';
print_r($_POST);
if (isset($_POST["btn"])) {
    $result = save_product($_POST);
}
?>
<html>
    <head></head>
</html>
<body>
    <a href="add_product.php">Add Pruduct</a>
    <a href="view_product.php">View  Pruduct</a>
    <h1><?php 
if (isset($result)) {
    echo $result;
}
?>
</h1>
    <form action="#" method="POST">
        <table>
        <tr>
            <td>Product Name</td>
            <td><input type="text" name="product_name"></td>
        </tr>
        
        <tr>
            <td>Product Description</td>
            <td>
<?php

require_once './function.php';
save_product($_POST);
<?php

require __DIR__ . '/../src/bootstrap_admin.php';
$product = ['id' => 0, 'name' => get_from_post('name', ''), 'price' => get_from_post('price', 0), 'brand' => get_from_post('brand', ''), 'description' => get_from_post('description', ''), 'categories' => get_from_post('categories', '')];
if (has_post()) {
    save_product($product);
    header('Location: /admin/index.php');
    die;
}
echo render_admin_template('product_form', ['title' => 'Add product', 'product' => $product, 'user' => get_current_admin_user()]);
示例#4
0
文件: Lite.php 项目: charlesqwu/lite
function save_products($store_id, $products)
{
    foreach ((array) $products as $product) {
        save_product($store_id, $product);
    }
}
示例#5
0
    $product_config_id = isset($_GET['product_config_id']) ? $_GET['product_config_id'] : -1;
    $rt = show_config_opt($_GET['content_type'], $product_config_id);
    echo $rt;
    exit;
}
// save/insert product
if (isset($_GET['action']) && $_GET['action'] == 'save_product') {
    $product_id = $_GET['product_id'];
    $name = SQLString($_GET['name'], "text");
    $description = SQLString($_GET['description'], 'text');
    $content_type = $_GET['content_type'];
    $workflow_id = $_GET['workflow_id'];
    $project_id = $_GET['project_id'];
    $access_matrix_id = $_GET['access_matrix_id'];
    $product_config_id = $_GET['product_config_id'];
    $rt = save_product($product_id, $name, $description, $content_type, $workflow_id, $project_id, $access_matrix_id, $product_config_id);
    if ($rt['status'] == 0) {
        $return = array('status' => 0, 'msg' => "Product " . $name . " saved successfully", 'sql' => $rt['sql'], 'product_opt' => $rt['product_opt'], 'product_id' => $rt['product_id']);
    } else {
        $return = array('status' => 1, 'msg' => $rt['msg']);
    }
    echo json_encode($return);
    exit;
}
// delete product
if (isset($_GET['action']) && $_GET['action'] == 'delete_product') {
    $sql = sprintf("SELECT * FROM goal WHERE entrance_product_id = %d OR inflight_product_id = %d OR exit_product_id = %d", $_GET['product_id'], $_GET['product_id'], $_GET['product_id']);
    $st = @mysql_query($sql);
    if (@mysql_num_rows($st) > 0) {
        $return = array('status' => 1, 'msg' => 'Cannot delete product because it is used by one or more goals');
        echo json_encode($return);
示例#6
0
文件: save.php 项目: etti-a2t/catalog
<?php

require_once __DIR__ . '/lib/functions.php';
save_product();