HTML表添加额外的
好的,我一直在看这段代码,我不明白为什么它会添加重复的th。表数据没有添加任何额外的td,所以我有点困惑。这可能是由于缺少某个元素造成的吗?我并不认为我的PHP代码会影响它HTML表添加额外的,html,Html,好的,我一直在看这段代码,我不明白为什么它会添加重复的th。表数据没有添加任何额外的td,所以我有点困惑。这可能是由于缺少某个元素造成的吗?我并不认为我的PHP代码会影响它 <!doctype html> <html> <head> <title></title> <meta charset="utf-8"> <meta name="description" content=""> <link rel="s
<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="description" content="">
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/master.css">
</head>
<body>
<?php
//header("Content-type: application/vnd.ms-excel");
//header("Content-Disposition: attachment; filename=excel.xls");
include('queries.php');
$role = $_POST["role"];
$menu = $_POST["menu"];
$tests = getTestCases($role, $menu);
?>
<form action="testCaseToExcel.php" method="post">
<input type="submit" value="Download to Excel" />
</form>
<table border="1" style="width: 100%;">
<thead>
<tr>
<th>Role<th>
<th>Path<th>
<th>Link<th>
<th>Link Type<th>
</tr>
</thead>
<?php
foreach ($tests as $test) { ?>
<tr>
<td>
<?php echo $test->role;?>
</td>
<td>
<?php echo $test->path;?>
</td>
<td>
<?php echo $test->link_name;?>
</td>
<td>
<?php echo $test->link_type;?>
</td>
</tr>
<?php }
?>
</table>
<form action="testCaseToExcel.php" method="post">
<input type="submit" value="Download to Excel" />
</form>
</body>
</html>
角色
路径
链接
链接类型
您未能关闭任何
标记。应该是:
<tr>
<th>Role</th>
<th>Path</th>
<th>Link</th>
<th>Link Type</th>
</tr>
角色
路径
链接
链接类型
您似乎在犯html语法错误
<tr>
<th>Role<th>
<th>Path<th>
<th>Link<th>
<th>Link Type<th>
</tr>
角色
路径
链接
链接类型
在代码中进行以下更改
我认为你应该在标题标签上使用结束标签,看看它是否有帮助
<tr>
<th>Role</th>
<th>Path</th>
<th>Link</th>
<th>Link Type</th>
</tr>
角色
路径
链接
链接类型
您没有像not那样关闭任何th标记…请参阅使用正确关闭的标记,它可以正常工作:@jrock2004:一个像样的IDE可以在这些问题发生之前解决它们。