Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8589567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:05:19+00:00 2026-06-11T23:05:19+00:00

Well, I have two files, the first one(users.php) displays the users and put delete

  • 0

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 :

$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();

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:05:20+00:00Added an answer on June 11, 2026 at 11:05 pm

    that could easily be done with JQuery, check the simple example below:

     <script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript">
    
    </script>
            <script language="javascript">
    $(document).ready(function () {
    
        function DeleteItDude() {
    
                    var param = "id=1";
                    $.ajax({
                        type: "POST",
                        url: "/delete.php",
                        data: param,
                        success: function (msg) {
    
                            alert(msg)
                        }
                    });
    }
    
                $("#lkDelete").click(function () {
                    DeleteItDude();
                }
    
    );
    
     });    
            </script>
    
    <a href="#" id="lkDelete">Delete it Dude</a>
    

    and Bang!! you have your delete without refreshing the page.

    in case you are not familiar, you will need to use JQuery framework to use the code above. access http://jquery.com/download/ to get the .js file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found two different things in two well known books in c, first
Well as I have posted earlier too...I have created a site in two languages.One
I have two models, first one is dependent on the second one, and I
Hey all, Here's a funny one. I have two ViewControllers: first one (fires on
I have two binary files that are related one to another (meaning, when one
Here, I have two different version of my code. The first one is a
I have two servlets below and work well with Tomcat7/Indigo, it will print '
I have two classes, ClassA and ClassB , as well as a many to
Using php I'd like to subtract/minus two times; each time within a separate document
I have a Python script that we're using to parse CSV files with user-entered

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.