linearspin linearspin - 4 months ago 10
HTML Question

html code does not continue after php ending bracket

All code is in index.php. In the head section I put

php
code, which has to catch the login action.

<?php
if (isset($_POST['sub_login'])) {

if ( uProfile::isLoginValid( $_POST['ilogin'], $_POST['ipass'] )) {

print 'You are loged in';
}
else print 'loggin failed';
}
?>


After login is clicked, the whole page turns blank, and
logging failed
isn't even showing. why is this, whats wrong here? Thanks for help.

*(login screen is available from index because of the contentModule() ):

<body>
<?php navModule() ?>

<?php conModule() ?>
</body>


conModule():

function conModule() {

$file_output;

if (isset($_GET['site'])) {

$file_path = "sites/{$_GET['site']}.htm";
$file_output = file_get_contents($file_path);
}

else {

$file_path = "sites/start.htm";
$file_output = file_get_contents($file_path);
}

print $file_output;
}

Answer
 function conModule() {

//    $file_output; // this variable does not exist

    if (isset($_GET['site'])) {

        $file_path = "sites/{$_GET['site']}.htm";
        $file_output = file_get_contents($file_path);
    }

    else {

        $file_path = "sites/start.htm";
        $file_output = file_get_contents($file_path);
    }

    return $file_output; // use return
   }

Please check that right.