I need some help with my coding:(. I have a php file with a delete link. It flags the user record with "1" when delete is clicked. What I don't know is that "how to remove the user record from my php file". The user record is fetched from mysql and is presented in a HTML table. What i want is that when a user clicks "delete" the row is the HTML table to disappear. The php coding for the delete.php is ok. can anyone help me please. My users.php codes are below.:'(
<?php include("_include/ssi/header.php"); ?>
<!-- TABLE CONTENTS FOR EXISTING USERS STARTS HERE -->
<table width="870" border="0" cellspacing="1" cellpadding="1" align="center" class="data-table">
<!--PAGINATION CODE STARTS HERE-->
<? //Query for Paging...
$str=mysql_query("select * from users order by user_Id") or die(mysql_error());
$totalrecord=mysql_num_rows($str);
$pagesize=10;
$noofpages=$totalrecord/$pagesize;
if (!isset($_REQUEST['startdata']))
$startdata=0;
else
$startdata=$_REQUEST['startdata'];
$count=$startdata;
$strrec="select * from users order by user_Id limit ".$startdata.",".$pagesize;
//Query for fetching admin details
$adm = mysql_query("SELECT admin_id, admin_forename, admin_surname, admin_username FROM admin");
while($admdb = mysql_fetch_array($adm)){
$admin[''.$admdb['admin_id'].''] = array($admdb['admin_forename'],$admdb['admin_surname'],$admdb['admin_username']);
}
//die(print_r($admin));
$k=0;
$res1=mysql_query($strrec) or die("cannot select user");
?>
<!--PAGINATION CODE-->
<tr>
<td colspan="8" class="bg">existing users</td>
</tr>
<tr>
<td width="105" class="table-head" style="font-weight:bold">ID</td>
<td width="162" class="table-head" style="font-weight:bold">Date</td>
<td width="147" class="table-head" style="font-weight:bold">User</td>
<td width="156" class="table-head" style="font-weight:bold">Last modified by</td>
<td width="105" class="table-head" style="font-weight:bold">Delete</td>
<td width="81" class="table-head" style="font-weight:bold">Edit</td>
</tr>
<?
while ($row=mysql_fetch_array($res1)) {
$k++;
$count++;
?>
<tr>
<td><img src="images/RecordIcon.jpg" width="15" height="16" alt="User Id" /> <? echo $count ?></td>
<td><? echo $row["user_date_created"] ?></td>
<td><? echo $row["user_surname"], " " ,$row["user_forename"] ?></td>
<td><? echo $admin[''.$row["user_creator"].''][0]." ".$admin[''.$row["user_creator"].''][1]; ?></td>
<td><a href="deleteuser.php?user_Id=<? echo $row["user_Id"] ?>"><img src="images/delete.gif" width="16" height="16" alt="Delete" border="0"/></a></td>
<td><a href="edit_user.php?user_Id=<? echo $row["user_Id"] ?> "><img src="images/edit.gif" width="16" height="16" alt="Edit" border="0"/></a></td>
</tr>
<? } ?>
<tr>
<td colspan="8" class="bg2"></td>
</tr>
</table>
</form>
<br />
<!--PAGINATION CODE-->
<div align="right" class="pagination">
<? //Query for displaying page numbers
if($startdata<>0)
{
$prev=$startdata-$pagesize;
echo "<a href='users.php?startdata=".$prev."'><font class=bold><b>« Prev</b></a> ";
}
?>
<font class="bold"></font>
<?
for ($i=0;$i<$noofpages;$i++)
{
$pageno=$i+1;
$j=($pagesize*$pageno)-$pagesize;
if ($startdata==0 && $i==0)
{
echo "<font class=bold>". $pageno."</b></span> ";
}
else
{
if($startdata == ($pagesize*($pageno))-$pagesize)
{
echo "<font class=bold>". $pageno."</font> ";
}
else
{
echo "<a href='users.php?startdata=".$j."'><font class=bold>". $pageno. "<font></a> ";
}
}
}
?>
</font>
<?
if($startdata+$pagesize<$totalrecord)
{
$next=$startdata+$pagesize;
echo " <a class=prevnext href='users.php?startdata=".$next."'><font class=bold>Next »</a>";
}
?>
</div>
<!--PAGINATION CODE ENDS HERE-->
<br/>
<!-- TABLE CONTENTS FOR EXISTING USERS ENDS HERE -->
<?php include("_include/ssi/footer.php"); ?>
Any help will be grealty appreciated.:D