我正在根据某些用户输入条件从数据库中回显一个表单。表单将包含 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 表格中的表单按钮样式有什么建议吗?
最佳答案
您可以简单地在 html 标签中使用样式,例如
echo "<td >"." <input type='submit' name=control value='Log' style='color:yellow;font-size:20px;border:none' class="submit"> "." </td>";
(或)
给按钮添加特定的类并为其编写css,例如:
.submit {
color: red;
}
关于html - 样式化 php 表单提交按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55829206/