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

  • Home
  • SEARCH
  • 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 3352514
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:02:22+00:00 2026-05-18T02:02:22+00:00

I have trouble to figure out a php problem described below. I have one

  • 0

I have trouble to figure out a php problem described below.

I have one PHP page that lists several users in a table (the list is generated by PHP). Next to every user, there is a “remove” button. By clicking this button, the page will redirect to a new removal confirmation page, and therefore we need to pass along information about the specifically chosen user.

My idea was to use a $_SESSION array that stores all the information about the chosen user (e.g. first, last name, user ID etc.), but I cannot figure out how the array should store the information for one specific user. Right now I’m using a while loop to generate the list of users:

      while ($row = mysqli_fetch_array($data)) { 
  // Display the user data
  echo '<td><strong>' . $row['first_name'] . '</strong></td>';
  echo '<td><strong>' . $row['last_name'] . '</strong></td>';
  echo '<td>' . $row['nickname'] . '</td>';
  ...

  echo '<td><a href="remove.php">Remove</a>'; // button should be here
  echo '</td></tr>';
  }
 echo '</table>';

How should I make sure that THAT particular Remove link fills the $_SESSION array with that user’s information? Right now, the while loop only creates a bunch of identical remove buttons that do not differentiate between the different users listed in the table. Any help is appreciated!

  • 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-05-18T02:02:23+00:00Added an answer on May 18, 2026 at 2:02 am

    Using a session is a bad approach in this situation. You probably just want to pass the user id to the removal confirmation page by appending the user id to the linked url:

    echo '<td><a href="remove.php?user_id='.$row['id'].'">Remove</a>';
    

    On the removal confirmation page, you can now access the passed user id with $_GET[“user_id”]

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

Sidebar

Related Questions

I have another script that I can't figure out what is wrong with it.
I have a script that appends some rows to a table. One of the
I have having trouble figure out how to write this code. I have a
I have trouble comparing 2 double in Excel VBA suppose that I have the
I have trouble using Perl grep() with a string that may contain chars that
I am trying to figure out the following simple problem in order to get
I seem to be having trouble with this. I have a Task table with
I'm having trouble figuring out the best way to store what information my users
Im having trouble trying to figure out some code someone has suggested and was
I'm trying to figure out how to capture a fully rendered page and manipulate

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.