[英]How to fetch data with same id in a row but different value in another column and display one month into table in php
[英]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”时,我想在那里有另一个页面的链接。 我怎样才能做到这一点?
如果我理解正确,您可以这样做:只需使用一个 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>
样式属性中缺少双引号 (")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.