title: Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd4/169/2461169/public_html/header.php:1) in
body: <p>I know this question has been asked before but I cannot find a way out of this. I need to go to sign in page once user logs out but it stays in member page and shows the error. I need to go to the page under the first conditional in member page. What can I do? Please help. Been trying many stuffs. May be I missed something. When I log out and again load member page it gives that error below while staying in member page:</p>
  
  <blockquote>
    <p>Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd4/169/2461169/public_html/header.php:1) in /storage/ssd4/169/2461169/public_html/member.php on line 6</p>
  </blockquote>
  
  <p>member page</p>
  
  <pre><code>&lt;?php
  include ("db_con.php");
  include ("index.php"); 
  if(!isset($_SESSION['email']))
  {
  header('location:https://goldentitles.000webhostapp.com/signin.php');
  }
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Member Area&lt;/title&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/member.css"&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/inpagetable.css"&gt;
  
  &lt;script type="text/javascript" src="js/member.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;!--member tabs--&gt;
  
  &lt;div class="tabmember"&gt;
  &lt;button class="tablinks" onclick="opentab1(event, 'profile')"&gt;Profile&lt;/button&gt;
  &lt;button class="tablinks" onclick="opentab2(event, 'edit')"&gt;Edit&lt;/button&gt;
  &lt;button class="tablinks" onclick="opentab(event, 'myorder')"&gt;My Order&lt;/button&gt;
  &lt;a href="logout_user.php"&gt;&lt;button class="tablinks"&gt;Log out&lt;/button&gt;&lt;/a&gt;
  
  &lt;/div&gt;
  &lt;!--profile tab--&gt;
  &lt;div id="profile"&gt;
  &lt;?php 
  
  
  $email=filter_var($_SESSION['email'],FILTER_SANITIZE_EMAIL) ;
  
  $user_query="select * from user where email='$email'"; 
  
  $run_query=mysqli_query($dbcon,$user_query);  
  
  if(mysqli_num_rows($run_query)&gt;0)  
  {  
  
  
  
  echo' &lt;table border="2" class=inpagetable&gt;
  &lt;thead&gt;
  &lt;tr&gt;
  &lt;th&gt;id&lt;/th&gt;
  &lt;th&gt;email&lt;/th&gt;
  &lt;th&gt;status&lt;/th&gt;
  &lt;th&gt;zip&lt;/th&gt;
  &lt;th&gt;name&lt;/th&gt;
  &lt;th&gt;password&lt;/th&gt;
  &lt;th&gt;address&lt;/th&gt;
  
  &lt;th&gt;country&lt;/th&gt;
  &lt;th&gt;expires&lt;/th&gt;
  
  &lt;/tr&gt;
  &lt;/thead&gt;';
  
  
  while( $row = mysqli_fetch_assoc( $run_query)){
  echo "&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;{$row['id']}&lt;/td&gt;&lt;td&gt;{$row['email']}&lt;/td&gt;&lt;td&gt;{$row['status']}&lt;/td&gt;&lt;td&gt;{$row['zip']}&lt;/td&gt;&lt;td&gt;{$row['name']}&lt;/td&gt;&lt;td&gt;{$row['password']}&lt;/td&gt;&lt;td&gt;{$row['address']}&lt;/td&gt;&lt;td&gt;{$row['country']}&lt;/td&gt;&lt;td&gt;{$row['expires']}&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;\n";
  }
  
  echo '&lt;/table&gt;';
  
  }
  else {echo"&lt;script&gt;alert('error retrieving from database! Contact admin!')&lt;/script&gt;"; 
  
  
  }
  
  //close con
  mysqli_close($dbcon);
  
  ?&gt;
  
  &lt;button class="mainpage" onclick="mainpg()"&gt;Back to Main Page&lt;/button&gt;&lt;br&gt;
  
  
  &lt;/div&gt;
  &lt;!--edit form--&gt;
  &lt;div id="edit"&gt;
  
  
  
  &lt;form id="actform" action="edit_user.php" method="post"&gt;
  
  
  
  &lt;input type="text" id="email" name="email_" placeholder="Your new email.."&gt; 
  
  
  &lt;input type="text" id="name" name="fullname" placeholder="Your new full name.."&gt;
  &lt;input type="password" id="pass" name="password" placeholder="Your new password.."&gt;
  
  
  &lt;input type="text" id="address" name="fulladdr" placeholder="Your new full address.."&gt;
  
  
  &lt;input type="text" id="zip" name="zipcode" placeholder="Your new zip code.."&gt;
  
  
  &lt;select id="country" name="country"&gt;
  &lt;option value="australia"&gt;Australia&lt;/option&gt;
  &lt;option value="canada"&gt;Canada&lt;/option&gt;
  &lt;option value="usa"&gt;USA&lt;/option&gt;
  &lt;option value="uk"&gt;UK&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;input type="submit" name="confirm" value="Confirm"&gt;
  
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My header page</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
         &lt;title&gt;Golden Titles&lt;/title&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;link rel="stylesheet" type="text/css" href="css/header.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div class="top"&gt;
  
  
  
      &lt;div id="header"&gt;
          &lt;a href="signin.php"&gt; Sign in&lt;/a&gt; |
          &lt;a href="signup.php"&gt; Sign up &lt;/a&gt; |
          &lt;a href="#"&gt; Help &lt;/a&gt; &lt;br&gt;
  
      &lt;/div&gt;
  
      &lt;div id="smedia"&gt;
  
          &lt;a href="https://www.facebook.com" &gt;&lt;img src="http://www.ransomesjacobsen.com/themes/jacobsen/images/icons/facebook-icon-small.png" alt="facebook" id="fb"&gt; &lt;/a&gt;
  
          &lt;a href="https://www.twitter.com" &gt; &lt;img src="http://www.freeiconspng.com/_img/icon-top-twitter.png" alt="twitter" id="tw"&gt;&lt;/a&gt;
          &lt;a href="https://www.instagram.com" &gt; &lt;img src="http://dunedin.art.museum/templates/dpag/images/instagram-icon.png" alt="instagram" id="ins"&gt;&lt;/a&gt;
  
  
      &lt;/div&gt;
  
      &lt;div id="search"&gt;
      &lt;form action="search.php" method="post"&gt;
      &lt;input type="search" name="searchdb" placeholder="enter book name only"&gt;
  
      &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;div id="kng"&gt;
          &lt;img src="img/kng.jpg" alt="knowledge is power"&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>