Home > Backend Development > PHP Tutorial > PHP 在table中剔除一条记录

PHP 在table中剔除一条记录

WBOY
Release: 2016-06-13 12:35:45
Original
821 people have browsed it

PHP 在table中删除一条记录
各位好,初次接触PHP弱弱的文革问题,

我想点击删除按钮的时候删除一条记录。如下图

下面把代码贴出来,

<br />
<br />
<script language="javascript" ><br />
	function Delete11(var id)<br />
	{	<br />
           .................<br />
	}<br />
</script><br />
<form action="delete.php" method = "post"><br />
	<table border = "1" cellpadding = "3" align = "center"><br />
	 <tr> <br />
	 	<th>编号</th><br />
        <th>商品名称</th> <br />
        <th>商品货号</th> <br />
        <th>商品价格</th><br />
        <th>促销价</th><br />
        <th>操作</th><br />
    </tr> <br />
	<?php <br />
		include ('..\Conn\ConnectionDB.php');<br />
			$sql = "select *from products";<br />
			$result = mysql_query($sql);<br />
			$row = mysql_fetch_row($result);<br />
			while ($row){<br />
	?><br />
			<br />
			<tr><br />
				<td><?php echo $row[0]?></td><br />
				<td><?php echo $row[3]?></td><br />
				<td><?php echo $row[2]?></td><br />
				<td><?php echo $row[11]?></td><br />
				<td><?php echo $row[12]?></td><br />
				<td><button  onclick = Delete11(<?php echo $row[0]?>)>删除</button></td><br />
			</tr><br />
	 <?php <br />
       	$row = mysql_fetch_row($result);}<br />
       ?><br />
	</table><br />
</form><br />
Copy after login


用JS怎么实现啊,还有如果不用JS怎么把我要删除记录的ID传到delete.php处理

PHP在table中删除一条记录
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template