Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 引导模式在单击时不起作用_Php_Jquery_Html_Twitter Bootstrap_Modal Dialog - Fatal编程技术网

Php 引导模式在单击时不起作用

Php 引导模式在单击时不起作用,php,jquery,html,twitter-bootstrap,modal-dialog,Php,Jquery,Html,Twitter Bootstrap,Modal Dialog,我正试图让按钮打开一个带有标签“Select Quantity and Sizes*:”的按钮,但由于某些原因,我无法让它正常工作,我将非常感谢您的提醒,请注意,我已经在footer.php文件的model中为updateSizes()函数添加了额外的jQuery。 我相信你的专业知识将帮助我解决这个问题,我有点困在这里,我复制了getbootstrap上的模式。com, 我的页面上的模式位于注释下方: PS:这只是一个个人测试项目,旨在提高我的技能,所以安全性虽然是一个非常重要的方面,但却受到

我正试图让按钮打开一个带有标签“Select Quantity and Sizes*:”的按钮,但由于某些原因,我无法让它正常工作,我将非常感谢您的提醒,请注意,我已经在footer.php文件的model中为updateSizes()函数添加了额外的jQuery。 我相信你的专业知识将帮助我解决这个问题,我有点困在这里,我复制了getbootstrap上的模式。com,

我的页面上的模式位于注释下方: PS:这只是一个个人测试项目,旨在提高我的技能,所以安全性虽然是一个非常重要的方面,但却受到了破坏

<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/eCommerce/core/init.php';
include 'includes/head.php';
include 'includes/navigation.php';


if (isset($_GET['add'])) {

    $brandQuery = $db->query("SELECT * FROM brand ORDER BY brand");
    /* making query and putting in alphabetical order */
    $parentQuery = $db->query("SELECT * FROM categories WHERE parent=0 ORDER BY Category");

    ?>

    <h2 class="text-center">Add a New Product</h2>
    <!-- Product upload form -->
    <form action="products.php?add=1" method="POST" enctype="multipart/form-data">
        <div class="form-group col-sm-3">
            <label for="title">Title*:</label>
            <input type="text" class="form-control" name="title" id="title" value="<?= ((isset($_POST['title'])) ? sanitize($_POST['title']) : ''); ?>">
        </div><!-- end div Title -->

        <div class="form-group col-sm-3">
            <label for="brand">Brand*:</label>
            <select class="form-control" id="brand" name="brand">
                <option value=""<?= ((isset($_POST['brand']) && $_POST['brand'] == '') ? ' selected' : ''); ?>></option>
                <?php while ($brand = mysqli_fetch_assoc($brandQuery)): ?>
                    <option value="<?= $brand['id'] ?>"<?= ((isset($_POST['brand']) && $_POST['brand'] == $brand['id']) ? ' selected' : ''); ?>><?= $brand['brand']; ?></option>
                <?php endwhile; ?>
            </select>
        </div> <!-- end div Select Brand -->

        <div class="form-group col-sm-3">
            <label for="parent">Main Category*:</label>
            <select class="form-control" id="parent" name="parent">
                <option value=""<?= ((isset($_POST['parent']) && $_POST['parent'] == '') ? ' selected' : ''); ?>></option>
                <?php while ($parent = mysqli_fetch_assoc($parentQuery)): ?>
                    <option value="<?= $parent['id'] ?>"<?= ((isset($_POST['parent']) && $_POST['parent'] == $parent['id']) ? ' selected' : ''); ?>><?= $parent['category']; ?></option>
                <?php endwhile; ?>
            </select>
        </div> <!-- end div Select Main Category -->

        <div class="form-group col-sm-3">
            <label for="child">Child Category*:</label>
            <select class="form-control" id="child" name="child">
            </select>
        </div> <!-- end div Select child Category -->

        <div class="form-group col-sm-3">
            <label for="price">Price*:</label>
            <input type="text" id="price" name="price" class="form-control" value="<?= ((isset($_POST['price'])) ? $_POST['price'] : ''); ?>">
        </div> <!-- end div Price -->

        <div class="form-group col-sm-3">
            <label for="list_price">List Price*:</label>
            <input type="text" id="list_price" name="list_price" class="form-control" value="<?= ((isset($_POST['list_price'])) ? $_POST['list_price'] : ''); ?>">
        </div> <!-- end div List Price -->

        <div class="form-group col-sm-3">
            <label for="price">Select Quantity and Sizes*:</label>
            <button  type="button" class="btn btn-success form-control" onclick="jQuery('#sizesModal').modal('toggle');return true;">Quantity $ Sizes</button>
        </div> <!-- end div Select Quantity and Prices -->

        <div class="form-group col-sm-3">
            <label for="sizes">Sizes and Quantity Preview*:</label>
            <input type="text" id="sizes" name="sizes" class="form-control" value="<?= ((isset($_POST['sizes'])) ? $_POST['sizes'] : ''); ?>" readonly>

        </div> <!-- end div Select Sizes and Qty Preview -->
        <div class="form-group col-sm-6">
            <label for="photo">Product Photo: </label>
            <input type="file" name="photo" id="photo" class="form-control">
        </div> <!-- end div Product Photo -->

        <div class="form-group col-sm-6">
            <label for="description">Product Description: </label>
            <textarea id="description" name="description" class="form-control" rows="6"><?= ((isset($_POST['description'])) ? sanitize($_POST['description']) : ''); ?></textarea>
        </div> <!-- end div Product Description-->
        <div class="form-group pull-right">
            <input type="submit" value="Add Product" class="form-control btn btn-success pull-right">
        </div>
        <div class="clearfix"></div>

    </form>

    <!-- Modal for Select Quantity and Sizes -->
    <div class="modal fade details-1" id="sizesModal" tabindex="-1" role="dialog" aria-labelledby="ModalSizesQuantityLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" type="button" onclick="closeModal()" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title text-center">Select quantity & Sizes</h4>
                </div> <!-- end modal-header -->
                <div class="modal-body">
                    <div class="container-fluid">
                        <div class="row">
                            ...
                        </div>
                    </div> <!-- end container-fluid -->
                </div> <!-- end modal-body -->
                <div class="modal-footer">
                    <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="updateSizes();jQuery('#sizesModal').modal('toggle');return false;">Save changes</button>
                </div>

            </div><!-- end modal content -->
        </div> <!-- end modal-dialog modal lg -->
    </div> <!-- End Modal for Size & Quantity -- >



<?php
}else {
    $sql = "SELECT*FROM products WHERE deleted = 0";
    $product_results = $db->query($sql);



    if (isset($_GET['featured'])) {
        $id = (int) $_GET['id'];
        $featured = (int) $_GET['featured'];
        $sql_feature = "UPDATE products SET feature = '$featured' WHERE id='$id' ";
        $db->query($sql_feature);
        header('Location:products.php');
    }

    ?>



    <h2 class="text-center">Products</h2>
    <a href="products.php?add=1" class="btn btn-success pull-right" id="add_product_btn">Add Product</a> <div class="clearfix"></div>
    <hr>

    <!-- Table for products -->
    <table class="table table-bordered table-condensed table-striped">
        <thead>
        <th></th>
        <th>Product</th>
        <th>Price</th>
        <th>Category</th>
        <th>Featured</th>
        <th>Sold</th>
    </thead>
    <tbody>
        <?php
        while ($product = mysqli_fetch_assoc($product_results)):
            /* setting category of child element */
            $childID = $product['categories'];
            $category_sql = "SELECT * FROM categories WHERE id = '$childID' ";
            $category_result = $db->query($category_sql);
            $category_child = mysqli_fetch_assoc($category_result);
            $parentID = $category_child['parent'];
            $parent_sql = "SELECT * FROM categories WHERE id ='$parentID' ";
            $parent_results = $db->query($parent_sql);
            $parent_fetch = mysqli_fetch_assoc($parent_results);
            $category = $parent_fetch['category'] . '-' . $category_child['category'];

            ?>
            <tr>
                <td>
                    <a href="products.php?edit=<?= $product['id']; ?>" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
                    <a href="products.php?delete=<?= $product['id']; ?>" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-trash">
                        </span></a>
                </td>
                <td><?= $product['title']; ?></td>
                <td><?= money($product['price']); ?></td>
                <td><?= $category; ?></td>

                <td><a href="products.php?featured=<?= (($product['feature'] == 0) ? '1' : '0'); ?> &id=<?= $product['id']; ?>" class="btn btn-xs btn-default"> <span class="glyphicon glyphicon-<?= (($product['feature'] == 1) ? 'minus' : 'plus'); ?>"></span></a>&nbsp <?= (($product['feature'] == 1) ? 'Featured Product' : ''); ?>
                </td>
                <td>0</td>
            </tr>
    <?php endwhile; ?>
    </tbody>
    </table>

<?php } include 'includes/footer.php'; ?>

添加新产品
标题*:

在onclick属性上使用引导的数据切换属性

<button  type="button" class="btn btn-success form-control" 
onclick="jQuery('#sizesModal').modal('toggle');return true;">
    Quantity $ Sizes
</button>

<button  type="button" class="btn btn-success form-control" 
data-toggle="modal" data-target="#sizesModal">
    Quantity $ Sizes
</button>

数量$size
数量$size
有关详细说明,请查看此链接


尝试将
jQuery
替换为
$
谢谢,但是没有用,我感谢你的贡献。