第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 PHP 中的表格格式按尺寸購物

使用 PHP 中的表格格式按尺寸購物

PHP
蕭十郎 2023-09-22 15:10:35
我希望我的網(wǎng)站在單擊桌面用戶表格單元格中的任何尺寸選項(xiàng)時(shí)搜索屬于特定尺寸的任何產(chǎn)品,但我遇到兩個挑戰(zhàn)我的水平單元循環(huán)應(yīng)該從左到右遞增,如下所示 28D、28DD、28E、28F、28FF、28G ...28K,然后移動到第二行 30D --- 30k,但它重復(fù)每個值 12 次水平像這樣28D,28D,28D 12次,然后移動到第二行28DD,再次重復(fù)12次。請問我的四循環(huán)可能有什么問題?我不知道如何在表格單元格周圍放置錨標(biāo)記以及如何在表格單元格中放置 name = size 屬性以使其鏈接 sizeresult.php。它將由選擇查詢處理,這是我的代碼:                <div class="table-responsive"><!-- table-responsive begin -->                     <table class="table table-striped table-hover"  border="0" width="100%" cellpadding="5" cellspacing="5">                         <thead>                             <tr>                                 <th class="success">                                 <h4 class="text-center white-text">D</h4>                                 </th>                                 <th class="info">                                 <h4 class="text-center white-text">DD</h4>                                 </th>                                 th class="danger">                                 <h4 class="text-center white-text">E</h4>                                 </th>                                 <th class="success">                                 <h4 class="text-center white-text">F</h4>                                 </th>                                 <th class="info">                                 <h4 class="text-center white-text">FF</h4>                                 </th>                                 <th class="danger">                                 <h4 class="text-center white-text">G</h4>sizeresult.php 代碼是這樣的:$size_name=$_POST['尺寸'];$run_products = mysqli_query($dbc,"SELECT * FROM products INNER JOIN SIZES USING (size_id) WHEREsizes.size ='%$size_name%'");
查看完整描述

1 回答

?
繁花不似錦

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個贊

我做了以下更改

  1. $count變量和for循環(huán)完全

  2. 創(chuàng)建了代碼塊,按照您在問題中解釋的方式格式化項(xiàng)目列表,每行按 12 個分組。

  3. 根據(jù)您使用錨標(biāo)記的請求,我添加了錨標(biāo)記,以便當(dāng)用戶單擊它時(shí),它將被帶到 sizeresult.php 頁面并處理查詢。

  4. 我通過將以下代碼放在 sizeresult.php 中查詢的正上方來確保 post 和 get 請求不會沖突

    if(isset($_GET['size'])){ $size_name=$_GET['size'] } else if(isset($_POST['size'])){ $size_name=$_POST['size']; }

您的主頁中的以下內(nèi)容

<div class="table-responsive"><!-- table-responsive begin -->

    <table class="table table-striped table-hover"  border="0" width="100%" cellpadding="5" cellspacing="5">

        <thead>

            <tr>

                <th class="success">

                <h4 class="text-center white-text">D</h4>

                </th>

                <th class="info">

                <h4 class="text-center white-text">DD</h4>

                </th>

                <th class="danger">

                <h4 class="text-center white-text">E</h4>

                </th>

                <th class="success">

                <h4 class="text-center white-text">F</h4>

                </th>

                <th class="info">

                <h4 class="text-center white-text">FF</h4>

                </th>

                <th class="danger">

                <h4 class="text-center white-text">G</h4>

                </th>

                <th class="success">

                <h4 class="text-center white-text">GG</h4>

                </th>

                <th class="info">

                <h4 class="text-center white-text">H</h4>

                </th>

                <th class="danger">

                <h4 class="text-center white-text">HH</h4>

                </th>

                <th class="success">

                <h4 class="text-center white-text">J</h4>

                </th>

                <th class="info">

                <h4 class="text-center white-text">JJ</h4>

                </th>

                <th class="danger">

                <h4 class="text-center white-text">K</h4>

                </th>

            </tr>

        </thead>

        <tbody>   

        <tr>

        <?php

            //$count = 12; // Number of possible cells to add at once://you don't need this too.

            $i=1;

            $get_sizes = "select * from sizes";

            $run_sizes = mysqli_query($dbc,$get_sizes);

            while ($row_sizes=mysqli_fetch_array($run_sizes)){

                $size_id = $row_sizes['size_id'];

                $size_name = $row_sizes['size'];

                if($i==12){

                    echo "<td align='center'><a href='product-card.php?size=$size_name' type='button' style='text-decoration:none; color:black;' class='btn btn-block'>$size_name</a></td>";

                    $i=1;

                    echo "</tr><tr>";

                }

                else {

                    echo "<td align='center'><a href='product-card.php?size=$size_name' type='button' style='text-decoration:none; color:black;' class='btn btn-block'>$size_name</a></td>";

                    $i++;

                } 

            } // End of while loop.

            ?>

            </tr>

        </tbody>

    </table> 

</div>         <!-- table-responsive end -->

 <!-- </form> you can remove this FORM tag if you want -->


查看完整回答
反對 回復(fù) 2023-09-22
  • 1 回答
  • 0 關(guān)注
  • 111 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號