kangjacob 2022-10-11 20:56 采纳率: 96.8%
浏览 14
已结题

<td></td>的宽度总是无法改变?请问谁知道原因?

<?php 
//这段代码对未通过会员认证的人进行了跳转登录页面的处理


if($_COOKIE['userRight']!= 'normalRight'){ 
    header('location:loginPage.php');
    exit();
}
require_once('dataBase.php');//create the connection to database
$userName=$_COOKIE['userName'];
$sql="SELECT * FROM result_table WHERE userName='$userName' ";
$result=$conn->query($sql);//we get all record in this step
$recordNumber=$result->num_rows;//we get the total number of the records'rows which we need
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>历史测评结果展示页面</title>
<style>
 div{
   width: 500px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 20px;
} 
table{
font-size: 30px;
text-align: center;
}

td{
white-space: nowrap;
padding: 10px;
width: 30px;
} 
input{
font-size: 18px;

}
</style>
</head>
<body>
<div>
<table >
<tr>
<td >测评人</td>
<td>测评时间</td>
<td>测评序列</td>
<td>查看结果</td>
</tr>
<?php
if($recordNumber>0){
    while($row=$result->fetch_assoc()){
        $userName=$row['userName'];
        $testDate=$row['testDate'];
        $testTime=$row['testTime']; //必须要转换一下,因为直接放到下面的 html代码块中 就会出现问题
        $testTime%2?$backGroundColor='F0F8FF':$backGroundColor='transparent';
        
        echo <<<EOF
    <form action='resultHistory.php' method='post'>    
    <tr>
    <td bgcolor=$backGroundColor ><input type='text' value='$userName'  readonly='readonly' >   
    <td bgcolor=$backGroundColor><input type='text' value='$testDate'  readonly='readonly'>  
    <td bgcolor=$backGroundColor><input type='text' value='$testTime'  readonly='readonly'> 
    <td bgcolor=$backGroundColor> <input type='submit' value='查看记录'>
    </tr> 
    </form>
EOF;

}

}else{
      echo '暂时没有进行任何测试';
}

$conn->close();
?>

</table>
</div>
</body>
</html>

  • 写回答

2条回答 默认 最新

  • 浪客 2022-10-11 21:04
    关注
    <form action='resultHistory.php' method='post'>提到table外面
    
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 10月20日
  • 已采纳回答 10月12日
  • 创建了问题 10月11日

悬赏问题

  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测