Reputation: 4807
I have problem and can not understand why this not working. The language not transferred and I see empty area.
In my PHP:
<?php
$_SESSION['Language'] = $_GET['Spanish'];
header("Location:../index.php");
exit;
?>
In index.php:
<?php
$Language = $_SESSION['Language'];
include 'header.php';
echo '<div id="content">
<img src="Images/SplashScreen.jpg" id="bgImage" alt="City" width="1280" height="720" />
<div class="splashOuterRingsOverlay" id="contain">
<img src="Images/Loading-outer-circle.png" id="image1" alt="inner ring" width="282" height="282">
</div>
<div class="splashInnerRingsOverlay" id="contain">
<img src="Images/Loading-inner-circle.png" id="image2" alt="outer ring" width="282" height="282">
</div>
<div class="splashButtonOverlay">
<!--<button type="button" id="splashButton" onclick="loadData(20)"></button>-->
<button type="button" id="splashButton" onclick="loadLangCustom(\'Spanish\')"></button>
</div>
<div class="splashTitleOverlay">
<p id="splashTitle">'.$Language.'</p>
<!--<p id="splashTitle">Please press BERMAD icon</p>-->
</div>
</div>';
include 'footer.php';
?>
Upvotes: 0
Views: 100
Reputation: 1698
Add session_start() in the beginning of your code
--
<?php
session_start();
$_SESSION['Language'] = $_GET['Spanish'];
<?php
session_start();
$Language = $_SESSION['Language'];
Upvotes: 2
Reputation: 12042
If you set the session variable you have to add the session_start at the top of the php page.
session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.
Change your code like this
<?php
session_start();
if (isset( $_GET['Spanish'])) {
$_SESSION['Language'] = $_GET['Spanish'];
header("Location:../index.php");
exit;
}
?>
Upvotes: 3