sessions headache...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi guys,

Here is my code. Redirect to index.php not working. Have trawled
through old topics but can't fix it.



if (isset($_POST["login"])) {
    $missingfields = array();

     foreach ($_POST as $var=>$val) {
         if ($val == "") {$missingfields[$var] = $val;}

     if (count($missingfields) > 0) {
         print "You missed out one or more fields:<BR />";
        foreach($missingfields as $key=>$value) {
            print $key . ", ";
     else {
    foreach ($_POST as $key => $value) {
     $_SESSION[$key] = $value;
    header("Location: ");

Any help or assistance appreciated.

Re: sessions headache...

Quoted text here. Click to load it

Usually when header() functions don't work it is because output has already  
started. This does throw a warning though if error_reporting is enabled. My  
guess is that some output gets send to the browser before the header goes  
out; It is also possible that spaces or other characters before or after the  
PHP tags (<?php ?>) trigger output before a header gets sent.  

Site Timeline