从表中删除选定的行

时间:2017-05-15 09:15:30

标签: php html

我需要使用复选框从表中删除/编辑选定的行 我正在显示我的数据库中的表

这是表格

<table width="100%" class="table-responsive" style="border: solid;border-color: white;">
<tr style="background: #737375;color: white;">
<td></td>
<td align="center" style="border: solid;border-color: white;">Accomodation</td>
<td style="border: solid;border-color: white;" align="center">Address</td><br>
<td style="border: solid;border-color: white;" align="center">Rooms</td>
<td align="center" style="border: solid;border-color: white;">Status</td>
<td align="center" style="border: solid;border-color: white;">Delete</td>
<td align="center" style="border: solid;border-color: white;">Edit</td>
</tr>

填写表格

<?php 
mysql_connect("localhost","","");
$link=mysql_select_db("orangeom_orangedb");
$req="select * from accomodation order by accid";
$res=mysql_query($req);
$i=1;
while ($ligne1=mysql_fetch_object($res))
{ $i=$i+1;
?>
<tr <?php if( bcmod($i, 2)==0) {echo "bgcolor='#FFCC99'"; } ?> >
<td style="border: solid;border-color: white;"><div class="radio" align="center">
<label><input type="radio" name="radio[]" id="radio[]" value="<?php echo $ligne1->accid;?>"></label>
</div></td> 
<td style="border: solid;border-color: white;"><input name="uid" type="hidden" id="uid" value="<?php echo $ligne1->accid;?>"/><?php echo $ligne1->name;?></td>
<td style="border: solid;border-color: white;"><?php echo $ligne1->address;?></td>
<td style="border: solid;border-color: white;"><?php echo $ligne1->rooms;?></td>
<?php
    if($ligne1->status =='1')
    {?>
    <td style="border: solid;border-color: white;"><div align="center"><img src="../../images/Active.png"  width="16px" height="16px"/></div></td>
    <?php
    }
    else
    {?>
    <td style="border: solid;border-color: white;"><div align="center"><img src="../../images/NotActive.png"  width="16px" height="16px"/></div></td>
    <?php
    }?>
    <td style="border: solid;border-color: white;"><div align="center"><a onclick="return confirm('Are you sure to delete ???');" href='delAccomodation.php?accid=<?php echo $ligne1->tripID; ?>&accid=<?php echo $ligne1->accid; ?>'><img src='../../images/Delete.png' width='16' height='16'/></a></div></td>
    <td style="border: solid;border-color: white;"><div align="center"><a href='interAccomodation.php?accid=<?php echo $ligne1->accid; ?>&accname=<?php echo $ligne1->name;?>&accaddress=<?php echo $ligne1->address; ?>&accrooms=<?php echo $ligne1->rooms; ?>&accstat=<?php echo $ligne1->status;?>'><img src='../../images/Edit.png' width='16' height='16' /></a></div></td>
</tr>
<?php }
mysql_close();?>
</table>

我想选择一行并按图片删除

<img src="../../images/delete.png" id="delete" width="16px" height="16px"/>

0 个答案:

没有答案