The problem is that the PHP Header Location does not work.
header('Location: index.php?action=new-game-step-choose-type');
It used to work, until I added those 3 styles.
If I delete those 3 styles, the app works again.
Since when does CSS properties influence the PHP ?
I developed a web app.
The app was running just fine.
Then, I added some styles :
#faq-page div {
margin: 5px;
padding: 5px;
}
#register-form-page div {
margin: 5px;
padding: 5px;
}
#login-form-page div {
margin: 5px;
padding: 5px;
}
After adding those styles, the app fails to work.
The warning that I see is :
Warning: Cannot modify header information - headers already sent by (output started at C:\laragon\www\the-aviator-web\menu.php:11) in C:\laragon\www\the-aviator-web\actions\action-new-game.php on line 11
There is nothing fancy within the menu.php
file :
<a href="index.php?action=main" class="menu">MAIN</a>
|
<?php
if (
isset($_SESSION['user_id'])
) {
//
?>
<a href="index.php?action=new-game" class="menu">NEW GAME</a>
|
<a href="index.php?action=join-game" class="menu">JOIN GAME</a>
|
<a href="index.php?action=friends" class="menu">FRIENDS</a>
|
<a href="index.php?action=logout" class="menu">LOGOUT</a>
<?php
//
} else {
//
?>
<a href="index.php?action=login-form" class="menu">LOGIN</a>
|
<a href="index.php?action=register-form" class="menu">REGISTER</a>
<?php
//
}
//
?>
|
<a href="index.php?action=faq" class="menu">FAQ</a>
Nothing fancy within the action-new-game
file :
<?php
if (
!defined('APP_NAME')
) {
die;
}
//echo __FILE__;
header('Location: index.php?action=new-game-step-choose-type');
The code should redirect the user, but it does not, because the CSS properties have some kind of strange influence and the php header code stops, it does not get triggered.
Also, nothing fancy within the files where I use those 3 styles :
<div id="register-form-page" class="color-fff">
...
</div>
I removed each of those 3 css properties and put them within the file where they are being used, and the code works again just fine :
<style>
#register-form-page div {
margin: 5px;
padding: 5px;
}
</style>
<div id="register-form-page" class="color-fff">
...
</div>
What's happening and why ?