0

我有这个查询:

$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,也没有显示底部表格。我明白为什么会这样,但无论如何我可以在桌子下面关联这个按钮吗?

4

1 回答 1

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'] . '">';
于 2013-11-01T14:08:32.303 回答