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 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答
  • ¥20 在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad'