桌子上的文字输入框 [英] A text input box on a table

查看:97
本文介绍了桌子上的文字输入框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有从数据库中选择数据的代码。然而,我想介绍一个名为Receipt的最后一列,这是一个文本区域列,用户可以输入与每条记录对齐的收据编号并提交保存。我的挑战是如何包含表单,以便文本框与从数据库中提取的每条记录对齐。任何人?感谢

这样如何在JQuery DataTables中的表格单元格中输入文本字段

I have this code that selects data from a database. I want to introduce a last column called "Receipt" however, this will be a text area column where a user can key in a receipt number aligned to every record and submit to save. My challenge is how do I include the form so that the text box will align with every record fetched from the database. Any one? Thanks
This way How to Make input text field inside table cell in JQuery DataTables

$sql = "SELECT * FROM customer";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
   echo "<table><tr><th>ID</th><th>Name</th><th>Amount</th><th>TransactionID</th><th>Mobile Number</th><th>Time Paid</th><th>Account</th></tr>";

 // output data of each row
 while($row = $result->fetch_assoc()) {
     echo "<tr><td>" . $row["id"]. "</td><td>" . $row["name"]. "</td><td>" . $row["amount"]. "</td><td>" . $row["trans_id"]. "</td><td>" . $row["msisdn"]. "</td><td>" . $row["time_paid"]. "</td><td>" . $row["status"]. "</td></tr>";
 }
 echo "</table>";
} else {
 echo "0 results";
}


推荐答案

表格中发布的内容。

echo "<h2 class=\"text-left\"My Table</h2><hr/>
                <table class=\"table\">
                  <thead>
                    <tr>
                      <th>Column 1</th>
                      <th>Column 2</th>
                      <th>Column 3</th>
                      <th>Column 4</th>
                    </tr>
                  </thead>
                  <tbody>";

之后,添加while语句,然后用
$关闭它b $ b

Afterwards, add your while statement, and then close it with

echo "</tbody>
        </table>"

这篇关于桌子上的文字输入框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆