php redirection not working
<p>Ive got this register script that puts the information into a mysql database. now it all works fine and when someone does something wrong its says the error (e.g. "Username not defined")</p>

<p>but when it goes wrong it does not look very good because it just displays the message on an empty page, so i thought i would make it redirect to the form page and display the message there. </p>

<p>here is the working script</p>

<pre><code>$forename = $_POST['forename'];      
$surname = $_POST['surname'];       
$email = $_POST['email'];    
$password = $_POST['password'];    
$username = $_POST['username'];
</code></pre>

<p><code>$errors = array()</code>;</p>

<pre><code> if(!$username) {

    $errors[] = "Username is not defined";

 }

 if(!$password) {

    $errors[] = "Password is not defined";

 }
</code></pre>

<p>and it continues.    </p>

<p>now i just thought i could do this</p>

<pre><code> $errors = array();

 if(!$username) {

    $errors[] = header( 'Location: http://localhost/muiltabledistractions/#!/page_register_error-Username-is-not-defined' ) ;

 }

 if(!$password) {

    $errors[] = "Password is not defined";

 }
</code></pre>

<p>but no, all it does is ignore it.</p>

<p>could someone please help me</p>

<p>please feel free to ask for more of the script if you need it</p>

<p>many thanks connor</p>
