制作一个没有sql的表


Make a table without sql

我在玩php代码,我试图在没有sql的情况下制作表,但我遇到了一个问题,它无法正常工作,这是我的表单

<form method="post">
    <table>
        <tr>
            <td colspan="2">
                Daftar Paket
            </td>
            <td>
            <select name="harga_paket">
            <?php 
                $paket="SELECT Nama_Paket from paket_harga"; 
                $querypkt=mysql_query($paket) or die(mysql_error());
                while($data=mysql_fetch_array($querypkt)){
            ?>
                    <option value="<?php echo $data['Nama_Paket']?>" id="menu"><?php echo $data['Nama_Paket'] ?></option>
                <?php } ?>
            </select>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                Jumlah Paket
            </td>
            <td colspan="2">
                <input type="text" name="jumlah" id="jumlah">
            </td>
            <td>
                <input type="submit" name="tambah" value="tambah">
            </td>
        </tr>
    </table>
</form>

这是我的php代码

<table border="2">
                <tr>
                    <th>
                        Paket
                    </th>
                    <th>
                        Jumlah
                    </th>
                    <th>
                        Harga
                    </th>
                    <th>
                        Total Harga
                    </th>
                </tr>
<?php 
    if(isset($_POST["tambah"])){
        $paket = $_POST['harga_paket'];
        $jumlah = $_POST['jumlah'];
        $sqlharga=mysql_query("select Harga_Paket from paket_harga where Nama_Paket='".$paket."' ") ;
        $data=mysql_fetch_array($sqlharga);
        $harga=$data['Harga_Paket'];
        $total_harga = $harga * $jumlah ;
        $value=array($paket,$jumlah,$harga,$total_harga);
    if(isset($value)){
        $jumlah=count($value);
        for($i=1; $i<=1;$i++){
            echo "<tr></tr>";
            $row[$i]=$value;
            for($j=0;$j<=$jumlah-1;$j++){
        ?>
                    <td>
                        <?php echo $row[$i][$j]; 
                        ?>
                    </td>
        <?php 
                        }
                    }
            }
        }
        ?>
    </table>

你能帮我扮演男人吗。?感谢您的所有回答:)

我想你正在寻找这样的东西。嗯,这确实使用了sql.:)

https://datatables.net/

https://github.com/DataTables/DataTables