title: PHP Header location in IF statement
body: <p>Im trying to write this script to say if email is valied insert into DB and redirect, else redirect with error message only my redirect isn't working, im not terribly great with php and still reading up on the subject so id appreciate any advice, thanks in advance!</p>
  
  <pre><code>&lt;?php
  
  $userid = $usersClass-&gt;userID();
  $user_email=$_POST['email_upd'];
  
  if(!filter_var($user_email, FILTER_VALIDATE_EMAIL))
  {
  header('Location: http://www.mysite.co.uk/mytwitter.php?msg=invalid');
  }
  else
  {
  mysql_query(" UPDATE produgg_users SET email='$user_email' where produgg_users.id = ".$usersClass-&gt;userID()) or die(mysql_error());
  header('Location: http://www.mysite.co.uk/mytwitter.php?msg=success');
  }
  
  ?&gt;
  </code></pre>
  
  <p>Sorry for not describing what goes wrong, what's happening is my page isnt redirecting back to the page in the header(location)</p>
  
  <p>I've now enabled Error reporting and im still only seeing a white page, heres my entire page code.</p>
  
  <pre><code>&lt;?php 
  
  error_reporting(E_ALL);
  require 'config.inc.php'; 
  
  
  ?&gt;
  
  &lt;?php
  
  $userid = $usersClass-&gt;userID();
  $user_email=$_POST['email_upd'];
  
  if(!filter_var($user_email, FILTER_VALIDATE_EMAIL))
      {
      header('Location: http://www..co.uk/mytwitter.php?msg=invalid');
      }
  else
      {
      mysql_query(" UPDATE produgg_users SET email='$user_email' where produgg_users.id = ".$usersClass-&gt;userID()) or die(mysql_error());
      header('Location: http://www..co.uk/mytwitter.php?msg=success');
      }
  
  ?&gt;
  </code></pre>