Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8740265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:06:03+00:00 2026-06-13T11:06:03+00:00

This is my first question here, probably a very simple one but I can’t

  • 0

This is my first question here, probably a very simple one but I can’t really find how to do it.

When I tried to google it, I only came across cookies and sessions, but I don’t know how to use them, and was hoping there was a more simple way. I only started with PHP today.

On the following page I want the user to be able to switch background, text color, text decoration, etc. I got that to work as well, but I would love to find a way to save the previous choice, and add it to the next one.

So if someone picks a red background-color, it should not switch back to white when they pick another style, such as a black text color.

Is there a easy way (for starters like me) to fix this?

This is the site so far: http://mark.wigf7.sde.dk/PHP/opgave_g.php?baggrundfarve=FF8000

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:06:04+00:00Added an answer on June 13, 2026 at 11:06 am

    To use the $_SESSION superglobal, first begin by adding this to the top of your PHP script(s):

    session_start();
    

    Then you can store data in $_SESSION and access it later.

    //Store user's selection
    $_SESSION['bg_color'] = $bg_color_choice;
    

    On next page:

    //Use default of #FFFFFF unless user made selection.
    $bg_color = isset($_SESSION['bg_color']) ? $_SESSION['bg_color'] : '#FFFFFF';
    

    EDIT: Since you linked to the page you’ll be using:

    $allowedColors = array(
        'FFFFFF',
        'D8D8D8',
        '000000'
    );
    
    if(isset($_GET['baggrundfarve']) && in_array($_GET['baggrundfarve'], $allowedColors)){
        $_SESSION['bg_color'] = $_GET['baggrundfarve'];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is probably a very simple question, but I can't seem to
All, This question probably has a very simple answer - something I'm overlooking. But
This is probably a very silly and simple question to most of you, but
this is my first question on here. The question is simple - # this
this is my first time asking a question here. I tried to be well
This is probably a very simple question that I am working through in an
This is probably a very simple question. I am new to Rails and have
First of all, the title of this question is horrible, but I didn't find
Hey guys. This is a very simple question, I'm sure, but I'm getting myself
I just started working with assembly so this is probably a really simple question,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.