【发布时间】:2019-04-24 11:38:26
【问题描述】:
我正在根据一些用户输入条件从数据库中回显一个表单。表单将包含 2 个按钮。我已经成功完成了。我只想为表单内的按钮设置样式(用于进一步步骤的按钮)。我不知道如何在 php 表单中设置按钮的样式。
$result = $conn->query ($sql);
if($result ->num_rows>0){
echo '<table >';
while($row = $result ->fetch_assoc()){
echo '<tr><th>Romm Number</th>';
echo '<td >' . $row['Number']. '</td></tr>';
echo '<tr><th>Room Temperature</th>';
echo '<td >' . $row['TEMP']. '</td></tr>';
//wanna style following form buttons
echo "<form action = 'script.php' method =post>";
echo '<tr>';
echo "<td > "." <input type=submit name=alarm value=Alarm> "." </td>";
echo "<td >"." <input type=hidden name=view value ='A'> "." </td>";
echo "</tr>";
echo "</form>";
echo "<form action = 'script2.php' method =post>";
echo '<tr>';
echo "<td >"." <input type=submit name=control value='Log'> "." </td>";
echo "<td >"." <input type=hidden name=graph value ='B'> "." </td>";
echo "</tr>";
echo "</form>";
}
echo "</table>";
mysqli_free_result($result);
}else {
echo "no result";
}
//mysqli_free_result($result);
$conn->close();
}
对 php 表格中的表单按钮样式有什么建议吗?
【问题讨论】:
-
和
css一样。 -
问题出在哪里?您可以为按钮添加一个类,然后编写相关规则。附:您的代码中有一些错误(type='submit'),
-
像这样?
-
向它们添加 class="submit_button" 并为该类添加 css 样式。