<table>
<tbody align="center" style="font-family:inherit">
<?php
$resultbooked ="SELECT *,b1.paid_amount as sub_total FROM booking_details b1,payment_history b2 WHERE b1.id='".$bookingid."' AND b2.booking_id='".$bookingid."'";
$exe= mysql_query($resultbooked);
$i=0;
while($bookedrow= mysql_fetch_array($exe))
{
$i++;?>
<tr>
<td style="display:none;"><?php echo $bookedrow['id']; ?></td>
<td><?php echo $i;?></td>
<td>
<?php $date_format=$bookedrow['present_date'];
echo $chng_date=date('d-m-Y',strtotime($date_format));?>
</td>
<td>
<?php echo $bookedrow['paid_amount'];
$total=$bookedrow['sub_total'];?>
</td>
<td>
<p class="current_pay" booking_id="<?php echo $bookingid;?>">
<p class="current_pay" pay_id="<?php echo $bookedrow['id'];?>"><span class="icon-print" style="cursor:pointer;"></span></p>
<?php
}?>
</td>
</tr>
</tbody>
</table>
<div id="payment_details<?php echo $bookedrow['id']; ?>" class="show_current_payment" style="display:none;margin: 0 auto; width: 60%; background:#FC9;">
<button onclick="printbill()" class="no-print button sButton bOlive">Print</button>
</div>
我正试图从select查询到div id-payment_details但我无法获得$bookedrow['id']值$bookedrow['id']值?我怎么能得到那个值在那个id值!!
如果$bookedrow["id"]总是表中的第一个,这似乎是可行的。它获取页面中第一个td元素中的文本(因此在php循环之后,当文本在那里回显时使用此方法),并将该值添加到隐藏的输入值中。
$("#id-payment_details").val($("td:first").text());