so the php could be something like this.
// Database Variables
define('DB_HOST', 'Database Host (Normally "localhost" if your script is on the same ip as the db');
define('DB_USER', 'Database User');
define('DB_PASSWORD', 'Database Password');
define('DB_DATABASE', 'Database Name');;
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
$table = "table you are pulling data from";
$username = $_SESSION['username'];
$query = "SELECT * FROM `table_name` WHERE username = ".$username;
//This is just an example where you can replace username with any column
$result = mysql_query($query) or die(mysql_error());
//Grab Information from query
if (mysql_numrows ($result) >= 1) {
$rows = mysql_fetch_array ($result, MYSQL_ASSOC);
foreach($rows AS $k => $v) {
$$k = $v;
}
}
you can put the above code at the top of the file.
then you can just go to where your legend tag is and eg...
<fieldset>
<legend>
<?php echo $username; ?>
</legend>
</fieldset>