0

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';
?>
1
  • var_dump($_GET['Spanish']); what does it returns Commented Mar 10, 2014 at 7:41

3 Answers 3

3

If you set the session variable you have to add the session_start at the top of the php page.

session_start()

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;
}

    ?>
Sign up to request clarification or add additional context in comments.

Comments

2

Add session_start() in the beginning of your code

--

<?php
session_start();
$_SESSION['Language']   = $_GET['Spanish'];




<?php
session_start();
$Language   = $_SESSION['Language'];

Comments

2

You are missing session_start() in index.php and my.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.