There are some ways to do that. I'll just list the way where it uses SESSION.
As each user logins to the webpage, you will create a SESSION to stores the userid for the particular user. Thus, it will be like this.
// Check for user login bla bla bla
If (userlogin) {
$_SESSION['userid'] = $userid;
}
So when the user click on the edit profile, it will call the database and retrieve the data.
// When the user click on the editprofile
$Q = "SELECT * FROM userprofile WHERE userid ="."'".$_SESSION['userid']."'";
$R = mysql_query($Q);
// This way, you will be able to get the user data from the database and then output to the user and let them see.