ログインしたユーザーの名前をページのタイトルにしたい。しかし、私はそれを行う方法がわかりません。いくつかの方法を試しましたが、それぞれが解析エラーを示しています。これは、ユーザーにログインして詳細を表示するための私のphpコードです。
<?php
//if the login session does not exist therefore meaning the user is not logged in
if(strcmp($_SESSION['uid'],"") == 0){
//display and error message
echo "<center>You need to be logged in to user this feature!</center>";
}else{
//otherwise continue the page
//this is out update script which should be used in each page to update the users online time
$time = date('U')+50;
$update = mysql_query("UPDATE `employer` SET `online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'");
$display_query = mysql_query("SELECT * FROM employer WHERE `id` = '".$_SESSION['uid']."'");
echo "<table id='pageTable'><tbody><th>Your Details</th>";
echo "<tbody>";
while($row = mysql_fetch_array($display_query)){
echo "<tr><td>Name: </td><td>".$row['name']."</td><tr>";
$titlename = $row['name'];
echo "<tr><td>E-Mail ID: </td><td>".$row['email']."</td><tr>";
echo "<tr><td>Contact No.: </td><td>".$row['contact']."</td><tr>";
echo "<tr><td>Company: </td><td>".$row['company']."</td><tr>";
echo "<tr><td>Designation: </td><td>".$row['designation']."</td><tr>";
}
echo "</tbody>";
echo "</table>";
echo "<table><tr><td>";
echo '<div class="button"><a href="functions/logout.php">Logout</a></td></tr></table>';
//make sure you close the check if they are online
}
?>