我有这个问题:
$result = mysqli_query($con,"SELECT * FROM b_tasks_report WHERE TASK_ID=$taskid ORDER BY WEEK_ID");
$current_week_id = -1;
while($row = mysqli_fetch_array($result))
{
if($current_week_id != $row['WEEK_ID'])
{
if($current_week_id != - 1)
{
echo "</table>";
}
echo "<table>";
echo "<tr class='no-border'><td class='no-border'><div class='task-detail-title'>Week Number: " . $row['WEEK_ID'] . "</div></td></tr>";
echo "<tr>";
echo "<th width='100'>Day</th>";
echo "<th width='75'>Start</th>";
echo "<th width='75'>End</th>";
echo "<th width='100'>Billable Hours</th>";
echo "<th width='100'>Non Billable Hours</th>";
echo "</tr>";
$current_week_id = $row['WEEK_ID'];
}
echo "<tr>";
echo "<td class='tdclass'>" . $row['DAY'] . "</td>";
echo "<td class='tdclass'>" . $row['START'] . "</td>";
echo "<td class='tdclass'>" . $row['END'] . "</td>";
echo "<td class='tdclass'>" . $row['BILLABLE_HOURS'] . "</td>";
echo "<td class='tdclass'>" . $row['NON_BILLABLE_HOURS'] . "</td>";
echo "</tr>";
}
if($current_week_id != - 1)
{
echo "</table>";
}
这为我提供了每周ID的单独表格。但是我希望在每个表格下面显示与上面结果相关的按钮。是否可以添加值为WEEK_ID的按钮。目前,如果我在顶部和底部添加一个带有值的按钮:
<input type='image' name='submit' src="image/button.jpg" value=" . $row['WEEK_ID'] . ">
它没有显示顶部表格的正确ID,并且底部没有显示任何内容。我明白为什么会这样,但无论如何我可以将这个按钮关联在桌子下面吗?
答案 0 :(得分:0)
在PHP标记之外使用它:
<input type="image" name="submit" src="image/button.jpg" value="<?php echo $row['WEEK_ID'] ?>">
在PHP标记内使用它。
echo '<input type="image" name="submit" src="image/button.jpg" value="' . $row['WEEK_ID'] . '">';