title: Display User Profile after Login in php
body: <p>i am new in php and still learning session in php. i want to display user profile after login. i use session. so, when user login, user can see and  her profile. i have try but still cant. please help me.</p>
  
  <p>this is login process.php</p>
  
  <pre><code>&lt;?php 
  
      session_start();
  
          require_once("connection.php");
  
          $email = $_POST['email'];
          $password = $_POST['password'];
          $name = $_POST['name'];
          $nname = $_POST['nname'];
          $bln = $_POST['bln'];
          $gender = $_POST['gender'];
  
  
          $cekuser = mysql_query("SELECT * FROM user WHERE email = '$email'");
          $jumlah = mysql_num_rows($cekuser);
          $hasil = mysql_fetch_array($cekuser);
  
  
          if($jumlah == 0) {
              echo "&lt;script&gt;alert('Email belum terdaftar!'); window.location = 'index.php'&lt;/script&gt;";
          } else {
              if($password &gt; $hasil['password']) {
              echo "&lt;script&gt;alert('Password Salah!'); window.location = 'index.php'&lt;/script&gt;";
              } else {
  
              $_SESSION['email'] = $email;
              $_SESSION['password'] = $password;
              $_SESSION['name'] = $name;  
              $_SESSION['nname'] = $nname;    
              $_SESSION['bln'] = $bln;    
              $_SESSION['gender'] = $gender;  
  
              header('location:index.php');
              }
          }
      ?&gt;
  </code></pre>
  
  <p>this is index.php</p>
  
  <pre><code>&lt;?php 
  
  if (session_status() == PHP_SESSION_NONE  || session_id() == '') {
          session_start();
      }
  
      require_once("connection.php");
      include("lib_function.php");
  ?&gt;
  
  &lt;---header---&gt;
  
  &lt;?php 
       include "connection.php";
       $sql = "SELECT name, email, nname, bln, gender e FROM user WHERE email = '" . $_SESSION['email'] . "'";
       $result = mysql_query($sql);
       if ($result !== false) {
           $row = mysql_fetch_array($result);
           echo "Hello, " . $row['name'] . " &lt;br&gt; " . $row['nname'] ."&lt;br&gt; " . $row['bln'] . " &lt;br&gt; " . $row['gender'] . "(" . $row['email'] . ").";
       } else {
         // an error has occured
         echo mysql_error();
         die;
               }
  ?&gt;
  </code></pre>