gpt4 book ai didi

php - 将 css 添加到表单

转载 作者:太空宇宙 更新时间:2023-11-03 23:21:37 25 4
gpt4 key购买 nike

我正在尝试将 CSS 添加到我的表单中,但不确定如何操作。该表单是在 php 和 MySQL 中创建的,在浏览器中它看起来像:http://gyazo.com/5d099ead9bd6ea83859a5114b2438748

我需要对齐文本和下拉菜单,使它们在整个过程中处于相等状态并添加一些间距。有人为此提供 CSS 方面的帮助吗?

目前的html:

  <div class="wrap">
<img src="/images/logo.png" alt="Highdown logo" />
<h1>Entry form</h1>
</div>

目前的CSS:

.wrap {
position: relative;
}

表单是这样生成的:

if ($event_result = $con->query("SELECT Event.Name FROM event")) {  
echo "<form method =\"POST\" action=\"save.php\"> ";
while ($row = $event_result->fetch_assoc()) {
echo $row['Name']. ' ';

if ($student_result = $con->query("SELECT Student.Form, Teacher.Form, Student.Forename, Student.Surname, Student_ID " .
"FROM Student, Teacher " .
"WHERE Student.Form = Teacher.Form AND Teacher.Username = '" . $_SESSION['Username'] . "'")) {

if ($student_result->num_rows) {
echo "<select name ='". $row['Name']."'>";
while ($row1 = $student_result->fetch_assoc()) {
echo '<option value="" style="display:none;"></option>';
echo "<option value ='" . $row1['Student_ID'] . "'>" . $row1['Forename'] . ' ' . $row1['Surname'] . "</option>";
}
echo "</select> <br />";
}
}
}
echo '<input type="submit" value ="Submit">';
echo '<input type="reset" value ="Reset">';

echo '<input type="button" value = "Add student" onclick="location.href=\'http://localhost/sportsday/addstudent.php\'">';
echo '<input type="button" value = "Delete student">';
echo "</form>";
}

最佳答案

使用

<form>
<table>
<tr> //1st Table row
<td></td> //Table column data
<td></td> //table column data
</tr> //1st row ends

<tr> // 2nd Table row
<td></td> //Table column data
<td></td> //table column data
</tr> //2nd row ends
</table>
</form>

这将为您提供更好的表单布局。

关于php - 将 css 添加到表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28471628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com