[ask]Auto Refresh
Posted: Tue Feb 02, 2010 8:28 am
This is the my table...

My question is...
1.After i click the delete button how to auto refresh the page, ive put the refresh tag right after the "if" condition, but nothing happened...
2.If i scroll down & checked one of the record, the page then automatically scroll up, its become problem when i need to check more than one record, so i have to scroll up everytime i checking a name...
3.How to make this "Record Deleted", display on top/above the table, but i can only put that under the if condition?
This is my code, still messy...

My question is...
1.After i click the delete button how to auto refresh the page, ive put the refresh tag right after the "if" condition, but nothing happened...
2.If i scroll down & checked one of the record, the page then automatically scroll up, its become problem when i need to check more than one record, so i have to scroll up everytime i checking a name...
3.How to make this "Record Deleted", display on top/above the table, but i can only put that under the if condition?
This is my code, still messy...
Code: Select all
<?
require("conn.php");
$do = "select * from invoice order by date DESC";
$qwery = mysql_query($do);
?>
<html><body>
<div id="hdr">
<h1>
Confirmed Order</h1></div>
<form action="" method="POST">
<table width="100%" id="top"><tr><td>
<center>
<input type="submit" name="delete" value="Delete" id="delete">
<input type="submit" name="refresh" value="Refresh" id="refresh">
</center>
</td></tr></table>
<?php
print ("
<table width=\"100%\" id=\"head\">
<tr>
<td width=\"\"><input type=checkbox name=del[] id=del value=$result[id]></td>
<td width=\"30%\"><b>Name</b></td>
<td width=\"30%\"><b>Number</b></td>
<td width=\"40%\"><b>Date</b></td>
</tr>
</table>
");
while ($result = mysql_fetch_array($qwery))
{
print ("
<a href=\"#\" class=\"des\">
<table width=\"100%\" id=\"list\">
<tr id=\"field\">
<td width=\"\"><input type=checkbox name=del[] id=del value=$result[id]></td>
<td width=\"30%\">$result[name]</td>
<td width=\"30%\">$result[number]</td>
<td width=\"40%\">$result[date]</td>
</tr>
</table>
</a>
");
}
?>
<table width="100%" id="list"><tr><td>
<center>
<input type="submit" name="delete" value="Delete" id="delete">
<input type="submit" name="refresh" value="Refresh" id="refresh">
</center>
</td></tr></table>
<?
$refresh = refresh;
if ($refresh)
{
print "<meta http-equiv=\"refresh\">";
}
?>
<?php
$id = $_POST[del];
$multi = count($id);
if($_POST['delete'])
{
for ($i=0; $i<$multi; $i++)
{
$dodel = "delete from invoice where id=$id[$i]";
$qwerydel = mysql_query($dodel);
print "<meta http-equiv=\"refresh\">";
}
if ($qwerydel)
{
print "Record Deleted<br>";
}
}
?>
</form>
</body></html>