Felipe Souza Felipe Souza -5 years ago 84
PHP Question

How to personalize info on a page?

Using PHP.

So I have a login system in place and a database set up with information about the users. Now let's say I want to link the user to a page after login and that page will contain his info. What is the most common way of doing this? Do I echo the whole HTML from a PHP file, or should I make an HTML page and alter it with AJAX somehow? Thanks in advance.

Answer Source

PHP is used within html. You can create the .php file and have raw html in there. Ex:

      session_start(); //Start user session to access $_SESSION variable
      echo 'Hello '.$_SESSION['username'].'.'; //If you had a username variable
  <div class="html-class">
     This is raw html.
   <?php echo 'This is content rendered by PHP'; ?>

As far as personalizing pages for users, look into sessions.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download