Jump to content

Multiple ?id=1


XeroXer

Recommended Posts

[u][b]Hi there.[/b][/u]

I am making a page where I want the user to be able to specify what look they want the page in.
So that on the startpage there shall be different colored squares that they can click.
And if they click the red one the design pick my [color=red][b]red.css[/b][/color] file to use.
By doing this I use the [color=red][b]?css=1[/b][/color] and different numbers.
Thought that creates a problem.

I use the [color=red][b]?id=1[/b][/color] to choose what page to show.
How do I do so that I can have more of these :-)...
I have seen pages using [color=red][b]index.php?id=1&?css=3[/b][/color].
Is this easy to do or?

Or maybe someone has a different idea on how to do the style switching?
Maybe using cookies so that if they return to the page the style they chose is still used.
Please post any tips you can think of...
Link to comment
Share on other sites

Ok!
How do I create a link that saves a cookie with the color information and then reloades the site to show the color they chose?
All the questions is because the first time I ever used cookies with a php script was yesterday. :-)

Because this would work to chek it right?
[code]<head>
<?php
$css = "$_COOKIE[css]";
if $css == "red" { $stylecss = "style_red.css"; }
elseif $css == "blue" { $stylecss = "style_blue.css"; }
elseif $css == "green" { $stylecss = "style_green.css"; }
elseif $css == "brown" { $stylecss = "style_brown.css"; }
else { $stylecss = "style.css"; }
?>
<link href="<?php echo $stylecss; ?>" rel="stylesheet" type="text/css">
</head>[/code]

I know that I can use:
[code]<?php
setcookie("css", "red", time()+36000);
?>[/code]
but not how to embed it into a link...
Link to comment
Share on other sites

just put that setcookie on top of a page that you will link to. say you have a link "changestyle.php?css=red", then on that changestyle.php page you can do
[code]<?php
setcookie('css',$_GET['css'],time()+36000);
header('Location: index.php');
?>[/code]
you can also make a dropdown list and a form for them to change the theme.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.