0

I have a list of profiles, and i need to make the user able to select the individual profile in a link.

I found this question and tried to follow it, but it doesnt quite work as i hoped it would: Displaying a user profile page PHP

The file to display all profiles on the page looks like this:

foreach ($rows as $row) {
    echo '<a class="viewProfile" href="user.php?id=' . $r['UID']. '"><button>View Profile</button></a>';
}

But when i click the link the UID doesn't get posted in the URL, and it just looks like this: domain/user.php?id=

Update: With help from you guys i got the UID posted into the URL. Thanks! And as jothi stated $id=$_GET['id'];

Community
  • 1
  • 1
frisk0k
  • 157
  • 1
  • 1
  • 11

1 Answers1

0

That's because $r['UID'] is not defined. You are enumerating some $row, so I assume that you mean $row['UID'].

If it doesn't work, please, post the result of this line, just before you foreach ($rows as $row)

echo print_r($rows);

B 7
  • 670
  • 7
  • 23