title: Notice: Array to string conversion PHP error, SESSION ARRAYS?
body: <p>im fairly new to php im trying to create a login, ive been trying to figure out what is wrong for past 2 days and have tried everything but could not find a solution to this, ive asked people looked all over the net but could not find a proper solution.</p>
  
  <p>I keep recieving this error when i try and login '</p>
  
  <p>Notice: Array to string conversion in __________ on line 6 Welcome Array.</p>
  
  <p>it seems like the array is causing the issue when i login i want it to display the users first name and last name. here is my code thanks in advance everyone :)</p>
  
  <pre><code>Login.php
  &lt;?php
  require_once('connect.php');
  include('includes/head.php');
   ?&gt;
  
   &lt;form action="&lt;?php $_SERVER['PHP_SELF'] ?&gt;" method="post" &gt;
   &lt;div class="container"&gt;
   &lt;fieldset&gt;
   &lt;h2&gt;Login&lt;/h2&gt;
   &lt;div class="row"&gt;
   &lt;label class="fixedwidth"&gt;Username:&lt;/label&gt;
   &lt;input type="text" name="username" required /&gt;
   &lt;/div&gt;
   &lt;div class="row"&gt;
   &lt;label class="fixedwidth"&gt;Password:&lt;/label&gt;
   &lt;input type="password" name="password" /&gt;
   &lt;/div&gt;
   &lt;div class="row"&gt;
   &lt;input type="submit" name="submit" value="LogIn" /&gt;
   &lt;/div&gt;
   &lt;/fieldset&gt;
   &lt;/div&gt;
   &lt;/form&gt;
  
   &lt;?php
  
   if(isset($_POST['submit']))  {
   require_once('connect.php');
   $username = mysqli_real_escape_string($connection, $_POST['username']);
   $password = mysqli_real_escape_string($connection, $_POST['password']);
  
   if(!empty($username) &amp;&amp; !empty($password))  {
  
  
  
  
      $query = "SELECT * FROM user where username='$username' and 
      password='$password'";
      $result = mysqli_query($connection, $query);
      $row=mysqli_fetch_array($result);
      mysqli_close($connection);
      if(mysqli_num_rows($result) ==1)  {
  
  
     $fullname=array(firstname=&gt;$row['firstname'],lastname=&gt;$row['lastname']);
      session_start();
  
      $_SESSION['user'] = $fullname;
  
      header('Location: welcome.php');
  
      }
      else    {
          echo "&lt;p&gt;Could not find you in the database.&lt;/p&gt;";
      }
      }
      else    {
      echo "&lt;p&gt;Either the username or password are invalid. Please try 
      again&lt;/p&gt;";
      }
  
  
       }
       ?&gt;     
  
  
  
  
  
  Logout.php
  &lt;?php
  session_start();
  
  unset($_SESSION['user']);
  // remove all session variables
  
  
  session_destroy();
  // destroy the session  
  
  header('Location: welcome.php');
  
  ?&gt;
  
  
  
  
  welcome.php
  &lt;?php
  include('includes/head.php');
  include('includes/nav2.php');
  session_start();
  
  echo 'Welcome '. $_SESSION['user'];
  echo '&lt;br&gt;&lt;br&gt;';
  ?&gt;
  </code></pre>