ボタンをクリックして、私のウェブサイトのテーマの色を変更できるようにしたい。現在私はURLにCSSのポインタを保存します。しかし、他のページにジャンプすると、CSSポインタが新しいページのURLから消えてしまうので、テーマの色はデフォルトに戻ります。どのようにすべてのページを現在の選択されたCSSを覚えているようにするには? PHPのセッションにCSSのポインタを保存することはできますか?どうやってするか?PHPスタイルシートのポインタをPHPセッションに保存するには?
コード:
<html>
<head>
<link rel="stylesheet" href="css/theme-<?php if ($css=="blue" || $css == "") echo "blue"; else echo $css; ?>.css" type="text/css" media="screen" title="csstheme" />
<?php require_once("session.php"); ?>
</head>
<body>
<a href="<?php print $_SERVER['PHP_SELF'];?>?<?php print $querystring;?>&css=blue" ><img src="http://plekz.com/images/layouts/blue.jpg" /></a>
<a href="<?php print $_SERVER['PHP_SELF'];?>?<?php print $querystring;?>&css=green" ><img src="http://plekz.com/images/layouts/green.jpg" /></a>
<a href="<?php print $_SERVER['PHP_SELF'];?>?<?php print $querystring;?>&css=pink" ><img src="http://plekz.com/images/layouts/pink.jpg" /></a>
<a href="<?php print $_SERVER['PHP_SELF'];?>?<?php print $querystring;?>&css=white" ><img src="http://plekz.com/images/layouts/white.jpg" /></a>
<a href="<?php print $_SERVER['PHP_SELF'];?>?<?php print $querystring;?>&css=red" ><img src="http://plekz.com/images/layouts/red.jpg" /></a>
</body>
</html>
はそれをやりました。できます。非常にありがとう:) – zac1987
@ zac1987私の喜び! :) –