我想创建一个html表单,连接到我在phpmyadmin的数据库中的表。我有3列:名称,决定,时间 - 以及提交按钮。我想从phpmyadmin表中提取名称并在表单中填充它,让他们从下拉菜单中选择决定,并将时间自动更新到他们点击提交时的时间。我可以弄清楚如何设置下拉菜单,但不预先填充名称字段或自动更新时间字段。如果你可以帮助解决这个问题的任何一个方面。我附上了我目前在这里的脚本:
SELECT LEFT(OD.number, 3) Terminal,
Count(LEFT(OD.number, 2)) OrderCount,
Count(OT.orderid)
FROM gff_bog_orderlocation.dbo.orderdetail OD,
gff_bog_orderlocation.dbo.ordertable OT
WHERE OT.orderid IN (SELECT orderid
FROM gff_bog_orderlocation.dbo.orderdetail
WHERE LEFT(number, 3) IN(SELECT LEFT(number, 3)
FROM
gff_bog_orderlocation.dbo.orderdetail
GROUP BY LEFT(number, 3)))
GROUP BY LEFT(OD.number, 3)
ORDER BY terminal
答案 0 :(得分:0)
将表重写为
<table border="1">
<?php
include "db.inc.php";//database connection which returns $dbLink as the connection.
$result = mysqli_query($dbLink, "SELECT * FROM Tester");
while ($row=mysqli_fetch_array($result))?>
<form action="edit_data.php" method="post">
<td><tr><input type="text" value="<?php echo $row['Name']; ?>"></tr></td>
<td><tr><select name="pulldown" name="Decision"/>
<option value=" ">Unworked</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="Maybe">Maybe</option?>
</tr></td>
<td><tr><input type="text" value="<?php echo $row['Time']; ?>"></tr></td>
<input type="submit" name="submit"></a>
</form>
</table>
像value="$row[Name]"
那样指定值不会告诉编译器它是一个php代码。它只是视为普通的HTML。
因此你必须在php代码块(<?php... ?>
);