这是我打印的代码:
on()
这是功能:
<div id="printthis">
<?php if(isset($_POST['p_id'])){
$p_id=trim($_POST['p_id']);
$select="select * from `bed_allotment` WHERE `p_id`='$p_id'";
$q=mysqli_query($mysqli,$select);
$bedCount = mysqli_num_rows($q);
if ($bedCount <= 0) {
echo "No Data Found";
return;
}
$row1=mysqli_fetch_assoc($q);
$checkin_date=$row1['checkin_date'];
$tmpDTVar = DateTime::createFromFormat('Y-m-d H:i:s', $checkin_date);
$tmpDTVar = $tmpDTVar->format('Y-m-d');
$checkout_date=date('Y-m-d');
$dateVar1 = DateTime::createFromFormat('Y-m-d', $tmpDTVar);
$dateVar2 = DateTime::createFromFormat('Y-m-d', $checkout_date);
$interval = $dateVar1->diff($dateVar2);
$totalAmt = 0;
$sql = "select bed_allotment.room_id,bed_allotment.bed_id,bed_allotment.checkin_date,bed_allotment.p_id,room_info.room_id,room_info.rate_per_day, room_info.room_type FROM bed_allotment
INNER JOIN room_info ON room_info.room_id=bed_allotment.room_id Where `bed_allotment`.p_id='$p_id' order by checkin_date asc";
$stmt = $conn->prepare($sql);
$stmt->execute();
$ctr=$stmt->rowCount();
if ($ctr > 0) {
$roomid_arr= array();
$roomid_name_arr= array();
$bedid_arr= array();
$dates_arr= array();
$days_arr = array();
$times_arr = array();
$RoomRatesID = array();
$RoomRatesRate = array();
while($row= $stmt->fetch()) {
array_push($roomid_arr,$row['room_id']);
array_push($roomid_name_arr,$row['room_type']);
array_push($bedid_arr,$row['bed_id']);
array_push($dates_arr,$row['checkin_date']);
}
$stmt = $conn->prepare($sql);
$stmt->execute();
while($row = $stmt->fetch()) {
for ($i = 1; $i <= count($dates_arr); $i++) {
$tmpfrom = DateTime::createFromFormat('Y-m-d H:i:s',$dates_arr[$i - 1]);
//var_dump($tmpfrom) ;
if($i == count($dates_arr))
$tmpTo = DateTime::createFromFormat('Y-m-d H:i:s',date('Y-m-d H:i:s'));
else
$tmpTo = DateTime::createFromFormat('Y-m-d H:i:s',$dates_arr[$i]);
$tmpDT = $tmpfrom->diff($tmpTo);
array_push($days_arr, $tmpDT->days);
array_push($times_arr, $tmpDT->h);
}
if (count($roomid_arr) <= 0) {
echo "No Data";
return;
}
if (in_array($row['room_id'],$roomid_arr)) {
array_push($RoomRatesID, $row['room_id']);
array_push($RoomRatesRate, $row['rate_per_day']);
}
}
if($bedCount <= 0) {
echo '
<div id="tow" style="display: none;">';
} else {
echo '
<div id="tow" style="display: block;">';
}
?></div>
我只在print.css中使用display:none,剩下的css来自main style.css。 我该怎么办??请帮我。哪里出错了。
答案 0 :(得分:0)
您需要添加media =&#34; print&#34;如果你想让你的CSS影响页面的印刷版本:
<link rel="stylesheet" href="css/print.css" type="text/css" media="print">
你试过这个吗?