How to place the title of the HTML page according to the user name in the database?

Asked

Viewed 712 times

1

Hello, I am creating a registration and login system, and I want that when the user finishes making his registration and login the first time, the title of the page of the site is with his name.

Kind of:

<!DOCTYPE html>
 <html>
 <head>
 <title> <?php echo $nomedapessoa; ?> </title>
 </head>
 <body>
 </body>
 </html>

But I am not able to do this communication with the database. I need a help from you.

Note: I use PHP.

  • Post the part of the database, it is easier to help.

  • Just a detail, because editing saw editing the question you speak in HTML page: for the server to read the variable, the page has to be .php.

1 answer

2

When logging in in php, register your user name in SESSION. Logged in to php, please:

<?php
       session_start();
?>
<!DOCTYPE html>
<html>
     <head>
          <title> <?php echo $_SESSION['nomedapessoa']; ?> </title>
     </head>
     <body>
     </body>
 </html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.