ขอความช่วยเหลือครับ ทำอย่างไรให้ EDIT (ที่link ไปแก้ไขข้อมูล) หายไป ถ้าใน field remark ปรากฎคำว่า "confirm" ขอบคุณมากครับผม
กำหนดให้หายไป เมื่อมีการ confirm รายการนั้น (control Edit button )
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<style type="text/css">
table#gridview {
clear:both;
}
table#gridview td {
padding:3px 0px;
}
table#gridview tr.head {
background:#B18904;
font-family:Arial, Helvetica, sans-serif;
text-align:center;
}
table#gridview tr.head td {
padding:3px 0px;
}
.bb2 {
font-size: 14px;
}
text-indent:0.5in;
#gridviewsss {
color: #FFF;
}
body {
background-color: #D3D3D3;
}
body,td,th {
color: #909090;
}
thead > tr{background:#A2C4AA;}
th, td{font-family:font-family:Arial, Helvetica, sans-serif}
thead th{color:#fff;font-size:14px;}
tr{height:44px;}
tbody > tr:nth-child(even) {background: #f3f3f3}
tbody > tr:nth-child(odd) {background: #fff}
tr.tr2 {background:#FFB7B7 !important}
tr.tr3{background:#DAF7A6 !important}
tbody > tr:hover, tr.tr2:hover, tr.tr3:hover{background:#fff5e6 !important}
tbody td{font-size:13px;color:#000}
</style>
<body>
<?php
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("ots_data");
$strSQL = "SELECT * FROM customer";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$strSQL .=" order by id desc ";
$objQuery = mysql_query($strSQL);
?>
<table class="display" width="800" height="135" border="0" align="center" cellpadding="1" cellspacing="1" id="gridview">
<thead> <tr>
<th width="35"> ID </th>
<th width="134" >Reservation Date</th>
<th width="212"> Guest Name</th>
<th width="161"> Destination</th>
<th width="79"> Amount</th>
<th width="41">Level</th>
<th width="64">Remark</th>
<th width="49"> </th>
</tr>
</thead>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
$tr_class = '';
if ($objResult['level'] == '2' OR $objResult['level'] == 3)
{
$tr_class = ' class="tr'.$objResult['level'].'"';
}
echo '<tr'.$tr_class.'>';
?>
<td height="42"><div align="center">
<?php echo $objResult["id"];?></div></td>
<td><?php echo $objResult["reservation_date"];?> </td>
<td><?php echo $objResult["destination"];?></td>
<td><?php echo $objResult["guest_name"];?></td>
<td><?php echo $objResult["amount"];?></td>
<td><?php echo $objResult["level"];?></td>
<td><?php echo $objResult["remark"];?></td>
<td bgcolor="#999999"><div align="center"><a href="edit.php?edit_id=<?=$objResult[id]?>">EDIT</a></div></td>
</tr>
<?php
}
?>
</table>
</body>
</html>Tag : PHP
Date :
2016-05-29 18:39:41
By :
panya@ots
View :
908
Reply :
4
<td bgcolor="#999999">
<div align="center" <?php echo (condition? 'style="display: none;" ' : '' );?>
><a href="edit.php?edit_id=<?=$objResult[id]?>">EDIT</a></div></td>
Date :
2016-05-30 07:50:37
By :
Chaidhanan
ไม่ได้ลองนะ
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<style type="text/css">
table#gridview {
clear:both;
}
table#gridview td {
padding:3px 0px;
}
table#gridview tr.head {
background:#B18904;
font-family:Arial, Helvetica, sans-serif;
text-align:center;
}
table#gridview tr.head td {
padding:3px 0px;
}
.bb2 {
font-size: 14px;
}
text-indent:0.5in;
#gridviewsss {
color: #FFF;
}
body {
background-color: #D3D3D3;
}
body,td,th {
color: #909090;
}
thead > tr{background:#A2C4AA;}
th, td{font-family:font-family:Arial, Helvetica, sans-serif}
thead th{color:#fff;font-size:14px;}
tr{height:44px;}
tbody > tr:nth-child(even) {background: #f3f3f3}
tbody > tr:nth-child(odd) {background: #fff}
tr.tr2 {background:#FFB7B7 !important}
tr.tr3{background:#DAF7A6 !important}
tbody > tr:hover, tr.tr2:hover, tr.tr3:hover{background:#fff5e6 !important}
tbody td{font-size:13px;color:#000}
tbody td > div{text-align:center}
.text-center{text-align:center}
.hide{display: none;visibility: hidden;}
</style>
<body>
<?php
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("ots_data");
$strSQL = "SELECT * FROM customer";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$strSQL .=" order by id desc ";
$objQuery = mysql_query($strSQL);
?>
<table class="display" width="800" height="135" border="0" align="center" cellpadding="1" cellspacing="1" id="gridview">
<thead> <tr>
<th width="35"> ID </th>
<th width="134" >Reservation Date</th>
<th width="212"> Guest Name</th>
<th width="161"> Destination</th>
<th width="79"> Amount</th>
<th width="41">Level</th>
<th width="64">Remark</th>
<th width="49"> </th>
</tr>
</thead>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
$id = $objResult["id"];
$remark = $objResult["remark"];
$edit_class = (trim($remark) == '') ? '' : ' hide';
$tr_class = '';
if ($objResult['level'] == '2' OR $objResult['level'] == 3)
{
$tr_class = ' class="tr'.$objResult['level'].'"';
}
echo '<tr'.$tr_class.'>';
?>
<td height="42"><div><?php echo $id;?></div></td>
<td><?php echo $objResult["reservation_date"];?></td>
<td><?php echo $objResult["destination"];?></td>
<td><?php echo $objResult["guest_name"];?></td>
<td><?php echo $objResult["amount"];?></td>
<td><?php echo $objResult["level"];?></td>
<td><?php echo $remark;?></td>
<td bgcolor="#999999"><div class="text-center<?php echo $edit_class;?>"><a href="edit.php?edit_id=<?=$id;?>">EDIT</a></div></td>
</tr>
<?php
}
?>
</table>
</body>
</html>
Date :
2016-05-30 10:22:43
By :
fossil31
Load balance : Server 02