【问题标题】:styling a php form submit button样式化一个 php 表单提交按钮
【发布时间】: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 样式。

标签: html css forms


【解决方案1】:

您可以简单地在 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;
}

【讨论】:

  • @dayDreamer 如果它有效,您可以通过按答案分数下方的勾号图标来标记它&lt;----。干杯:-)
猜你喜欢
  • 2012-06-30
  • 2013-02-15
  • 1970-01-01
  • 2012-09-20
  • 2013-01-21
  • 1970-01-01
  • 1970-01-01
  • 2014-01-31
  • 2012-01-23
相关资源
最近更新 更多