C - Settings

Create a Olympic Games website that uses PHP session variables to store the user’s display settings.

The website should contain these pages:

  • index.php – Olympic Games homepage
  • sprint.php  – information about the 100m sprint
  • highjump.php – information about the high jump
  • settings.php – allows the user to change the website appearance

The Settings page should contain a form where the user can select:

  • Background colour: red, blue or green
  • Font size: small, medium or large

These options should be stored in session variables and used to style each page of the website.

Help

<html>
<head>
    <title>Olympic Games</title>
    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
            background-color: blue;
            font-size: 14px;
            color: #222;
        }

        header {
            background: #1d3557;
            color: white;
            padding: 20px;
            text-align: center;
        }

        nav {
            background: #274c77;
            padding: 12px;
            text-align: center;
        }

        nav a {
            color: white;
            text-decoration: none;
            margin: 0 12px;
            font-weight: bold;
        }

        main {
            max-width: 900px;
            margin: 30px auto;
            padding: 20px;
        }

        .cards {
            display: flex;
            gap: 20px;
            flex-wrap: wrap;
        }

        .card {
            flex: 1;
            min-width: 240px;
            background: rgba(255,255,255,0.85);
            border: 2px solid #1d3557;
            border-radius: 12px;
            padding: 20px;
        }

        .rings {
            font-size: 42px;
            letter-spacing: 8px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
<header>
    <h1>Olympic Games</h1>
    <div class="rings">◯ ◯ ◯ ◯ ◯</div>
</header>

<nav>
    <a href="index.php">Home</a>
    <a href="sprint.php">100m Sprint</a>
    <a href="highjump.php">High Jump</a>
    <a href="settings.php">Settings</a>
</nav>

<main>
    <h2>Welcome to the Olympic Games Website</h2>
    <p>Explore two famous Olympic athletics events and customise how the website looks using the settings page.</p>

    <div class="cards">
        <div class="card">
            <h3>100m Sprint</h3>
            <p>The 100m sprint is one of the fastest and most exciting events in athletics.</p>
            <a href="sprint.php">View event</a>
        </div>

        <div class="card">
            <h3>High Jump</h3>
            <p>The high jump challenges athletes to clear a horizontal bar without knocking it down.</p>
            <a href="highjump.php">View event</a>
        </div>
    </div>
</main>
</body>
</html>
<html>
<head>
    <title>100m Sprint</title>
    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
            background-color: blue;
            font-size: 14px;
            color: #222;
        }

        header {
            background: #1d3557;
            color: white;
            padding: 20px;
            text-align: center;
        }

        nav {
            background: #274c77;
            padding: 12px;
            text-align: center;
        }

        nav a {
            color: white;
            text-decoration: none;
            margin: 0 12px;
            font-weight: bold;
        }

        main {
            max-width: 800px;
            margin: 30px auto;
            padding: 25px;
            background: rgba(255,255,255,0.85);
            border-radius: 12px;
        }
    </style>
</head>
<body>
<header>
    <h1>100m Sprint</h1>
</header>

<nav>
    <a href="index.php">Home</a>
    <a href="sprint.php">100m Sprint</a>
    <a href="highjump.php">High Jump</a>
    <a href="settings.php">Settings</a>
</nav>

<main>
    <h2>The 100m Sprint</h2>
    <p>The 100m sprint is a short-distance running event. Athletes race in separate lanes and try to reach the finish line in the shortest possible time.</p>
    <p>Because the race is so short, a fast reaction at the start and powerful acceleration are extremely important.</p>
</main>
</body>
</html>
<html>
<head>
    <title>High Jump</title>
    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
            background-color: <?php echo $_SESSION["background"]; ?>;
            font-size: <?php echo $_SESSION["fontSize"]; ?>;
            color: #222;
        }

        header {
            background: #1d3557;
            color: white;
            padding: 20px;
            text-align: center;
        }

        nav {
            background: #274c77;
            padding: 12px;
            text-align: center;
        }

        nav a {
            color: white;
            text-decoration: none;
            margin: 0 12px;
            font-weight: bold;
        }

        main {
            max-width: 800px;
            margin: 30px auto;
            padding: 25px;
            background: rgba(255,255,255,0.85);
            border-radius: 12px;
        }
    </style>
</head>
<body>
<header>
    <h1>High Jump</h1>
</header>

<nav>
    <a href="index.php">Home</a>
    <a href="sprint.php">100m Sprint</a>
    <a href="highjump.php">High Jump</a>
    <a href="settings.php">Settings</a>
</nav>

<main>
    <h2>The High Jump</h2>
    <p>In the high jump, athletes run towards a horizontal bar and attempt to jump over it without knocking it down.</p>
    <p>The bar is raised as the competition continues. The athlete who clears the greatest height wins.</p>
</main>
</body>
</html>
<style>
    body
    {
        background-color: <?php echo $_SESSION["background"]; ?>;
    }
</style>