Deleting records without being redirected
<p>Well, I have two files, the first one(users.php) displays the users and put "delete" link next to each user.and the other file(delete.php) delete records when someone clicks on the "delete link".
Here's the delete.php :</p>

<pre><code>$user_id = $_REQUEST['id'];
$delete_query = sprintf("DELETE FROM 'tablename' WHERE id = %d", $id);
mysql_query($delete_query);
$msg = "the users has been deleted";
header("Location: http://localhost/intranet/in-admin-panel/users.php?success_message={$msg}");
exit();
</code></pre>

<p>My problem is, when I made the pagination to paginate the users, I found myself redirected to the first page even when I delete a user in the page3 for exemple(which is obvious from the script)
I tried redirecting to the previous page using($_SERVER['HTTP_REFERER']), but as I read it's not secure and not practical.
I'm wondering if there is a solution to this issue using php,or I'm forced to learn ajax to do it.</p>
