My html form:
news_list.php
<?php
include("admin.php");
include("connection.php");
$sql=mysql_query("select * from news order by id");
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<!--<form name="frm" action="news_delete.php" method="post">-->
<div align="center" style="width:700px; height:auto; float:left;border:solid 1px #DCDCDC; margin-top:20px;"><!--main div-->
<div align="center" style="width:700px; height:auto; float:left;border:solid 1px #DCDCDC;">
<div align="center" style="width:50px; height:auto; float:left;border:solid 1px #DCDCDC;">NO</div>
<div align="center" style="width:300px; height:auto; float:left;border:solid 1px #DCDCDC;">NEWS</div>
</div>
<div align="center" style="width:300px; height:auto; float:left;border:solid 1px #DCDCDC;">
<?php
if($sql>0)
{
while($row=mysql_fetch_array($sql))
{
$id=$row['id'];
$msg=$row['details'];
?>
<div align="center" style="width:700px; height:auto; float:left;border:solid 1px #DCDCDC;">
<div align="center" style="width:50px; height:auto; float:left;border:solid 1px #DCDCDC;"><?php echo $id?></div>
<div align="center" style="width:300px; height:auto; float:left;border:solid 1px #DCDCDC;"><?php echo $msg?></div>
<div align="center" style="width:100px; height:auto; float:left;border:solid 1px #DCDCDC;"><a href="news_edit.php">EDIT</a></div>
<!--<div align="center" style="width:100px; height:auto; float:left;border:solid 1px #DCDCDC;"><button onclick="window.location.href='news_delete.php'">DELETE</button></div>-->
<div align="center" style="width:50px; height:auto; float:left;border:solid 1px #DCDCDC;"><a href="news_delete.php?id=$id">delete</a></div>
<!--<div align="center" style="width:50px; height:auto; float:left;border:solid 1px #DCDCDC;"><input name="delete" type="submit" value="DELETE"/></div>
-->
<?php
}
}
?>
</div>
</div>
<div align="center" style="width:100px; height:auto; float:left; margin-left:550px;"><a href="news.php">ADD NEW</a></div>
</div><!--main div ends-->
<!--</form>-->
</body>
</html>
news_delete.php
<?php
include('connection.php');
if(isset($_GET['id']))
{
$id=$_GET['id'];
$query1=mysql_query("delete from news where id='$id'");
if($query1)
{
header('location:news_list.php');
}
}
?>
on clicking the button(delete) control rem,aining in news_list page.what is the problem in this code?