php - html: table同一列每一行不同数据
php - html: Different data in each row of a the same column in a table
我想根据 $row['epilogh']:
的值,使同一列的每一行的单元格数据不同
<tr>
<td> <?php echo $row['id']; ?> </td>
<td> <?php echo $row['epilogh']; ?> </td>
<td> <?php echo $row['um_username']; ?> </td>
<td> <?php echo $row['myrole'];?> </td>
<td> <?php echo $row['request_date'];?> </td>
<!-- i want the following 2 td to be one and work in the above different cases -->
<td style="max-width: 250px; text-align: center;">
<?php echo '<a href="../make-solemn-declaration-pdf-sec/?id='.$row['id'].'" target="_blank">'.$row['id'].'</a>';?>
<form action="../make-solemn-declaration-pdf/?id=<?php echo $id; ?>" method="POST" target="_blank">
<button type="submit" name="btn-pdf">Make a PDF</button>
</form>
</td>
<td style="max-width: 250px">
<form method="POST" enctype="multipart/form-data" action="../upload-file/?id=<?php echo $row['id']; ?>">
<input type="file" name="fileToUpload" id="fileToUpload" accept=".pdf" required />
<br><hr>
<input type="submit" name="submit" value="Upload" />
<? echo "$pdf";?>
</form>
</td>
<td> <a href="../pistop-delete/?id=<?php echo $row['id']; ?>">Delete</a> </td>
</tr>
所以假设如果 $row['epilogh']
是 'A' 我想要一个表单以便可以上传文件。另一方面,当 $row['epilogh']
为 'B' 时,我希望在另一页中有一个 link。我该怎么做?
如果我没理解错的话,你可以这样做:
只需使用一个 td:
<td style="max-width: 250px;<?php if($row['epilogh'] == 'A') echo 'text-align: center;' ?> ">
<?php
if($row['epilogh'] == 'A'){
echo "your upload form"
}
else{
echo "your link to another page"
}
?>
</td>
我想根据 $row['epilogh']:
的值,使同一列的每一行的单元格数据不同<tr>
<td> <?php echo $row['id']; ?> </td>
<td> <?php echo $row['epilogh']; ?> </td>
<td> <?php echo $row['um_username']; ?> </td>
<td> <?php echo $row['myrole'];?> </td>
<td> <?php echo $row['request_date'];?> </td>
<!-- i want the following 2 td to be one and work in the above different cases -->
<td style="max-width: 250px; text-align: center;">
<?php echo '<a href="../make-solemn-declaration-pdf-sec/?id='.$row['id'].'" target="_blank">'.$row['id'].'</a>';?>
<form action="../make-solemn-declaration-pdf/?id=<?php echo $id; ?>" method="POST" target="_blank">
<button type="submit" name="btn-pdf">Make a PDF</button>
</form>
</td>
<td style="max-width: 250px">
<form method="POST" enctype="multipart/form-data" action="../upload-file/?id=<?php echo $row['id']; ?>">
<input type="file" name="fileToUpload" id="fileToUpload" accept=".pdf" required />
<br><hr>
<input type="submit" name="submit" value="Upload" />
<? echo "$pdf";?>
</form>
</td>
<td> <a href="../pistop-delete/?id=<?php echo $row['id']; ?>">Delete</a> </td>
</tr>
所以假设如果 $row['epilogh']
是 'A' 我想要一个表单以便可以上传文件。另一方面,当 $row['epilogh']
为 'B' 时,我希望在另一页中有一个 link。我该怎么做?
如果我没理解错的话,你可以这样做: 只需使用一个 td:
<td style="max-width: 250px;<?php if($row['epilogh'] == 'A') echo 'text-align: center;' ?> ">
<?php
if($row['epilogh'] == 'A'){
echo "your upload form"
}
else{
echo "your link to another page"
}
?>
</td>