如何修复选择框搜索

时间:2017-01-17 02:16:56

标签: php html ajax

有人可以检查代码并告诉我如何修复它吗?例如:如果第二个选择框操作为== 'showAll',那么所有框操作都会变为== 'showAll'(它不会变为:从国家/地区到国家/地区类型,但我看到所有内容不仅仅是选择框)。请帮我解决。

主页:

<script src="public/js/transport-search.js"></script>

<div class="container" style="padding-top: 50px;">
    <h1>
        Transport (Total:<?php
        $getTransport = $tr->getAll();
        $total = 0;
        if($getTransport) {
            while($result = $getTransport->fetch_assoc()) {
                $total++;
            }
            echo $total;
        }
        ?>)
    </h1>
    <?php
    $login  = Session::get('clubLogin');
    if ($login == true) {
        ?>
        <button type="button" class="btn btn-primary btn-md" onclick="location.href='transport-add.php';"><span
                    class="glyphicon glyphicon-plus"></span> Add new
        </button>
        <?php
    }
    ?>
    <hr/>
    <div class="row">
        <div class="col-sm-4">
            <select id="getFrcountries" class="form-control" required>
                <option value="showAll" selected>From country</option>
                <?php
                $getLocFr = $tr->getCountries();
                if ($getLocFr) {
                    while ($result = $getLocFr->fetch_assoc()) {
                        ?>
                        <option value="<?php echo $result['frcountry'] ?>"><?php echo $result['frcountry'] ?></option>
                        <?php
                    }
                }
                ?>
            </select>
        </div>
        <div class="col-sm-4">
            <select id="getTocountries" class="form-control" required>
                <option value="showAll" selected>To country</option>
                <?php
                $getLocTo = $tr->getCountries();
                if ($getLocTo) {
                    while ($result = $getLocTo->fetch_assoc()) {
                        ?>
                        <option value="<?php echo $result['tocountry'] ?>"><?php echo $result['tocountry'] ?></option>
                        <?php
                    }
                }
                ?>
            </select>
        </div>
        <div class="col-sm-4">
            <select id="getTypes" class="form-control" required>
                <option value="showAll" selected>Type</option>
                <?php
                $getType = $tr->getTypes();
                if ($getType) {
                    while ($result = $getType->fetch_assoc()) {
                        ?>
                        <option value="<?php echo $result['type'] ?>"><?php echo $result['type'] ?></option>
                        <?php
                    }
                }
                ?>
            </select>
        </div>
    </div>
    <hr/>
    <div class="row">
        <div class="col-sm-12">
            <div class="col-sm-2 text-center">
                <p>From country</p>
            </div>
            <div class="col-sm-2 text-center">
                <p>To country</p>
            </div>
            <div class="col-sm-2 text-center">
                <p>Type</p>
            </div>
            <div class="col-sm-2 text-center">
                <p>Price</p>
            </div>
            <div class="col-sm-2 text-center">
                <p>Date</p>
            </div>
            <div class="col-sm-2 text-center">
                <p>Profile</p>
            </div>
        </div>
    </div>
    <div class="" id="display">
        <!-- Records will be displayed here -->
    </div>
</div>

脚本:http://pastebin.com/xZibc81C

搜索:http://pastebin.com/L6NzT1N5

0 个答案:

没有答案