Basically what I’m trying to do is have it so when a user selects a certain button it will reload the page using the style sheet that their input selects.
Not sure why this isn’t working, but this is what I’ve got:
[code=php]
<?php
echo “<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>”;
echo “<head><title> {$title} </title>”;
if (“‘$_POST[default]'”)
{
echo “<link rel=”stylesheet” href=”style1.css” type=”text/css”>”;
}
elseif (“‘$_POST[black]'”)
{
echo “<link rel=”stylesheet” href=”style2.css” type=”text/css”>”;
}
elseif (“‘$_POST[purple]'”)
{
echo “<link rel=”stylesheet” href=”style3.css” type=”text/css”>”;
}
elseif (“‘$_POST[white]'”)
{
echo “<link rel=”stylesheet” href=”style4.css” type=”text/css”>”;
}
else
{
echo “There was an error.”;
}
echo “</head>”;
echo “<body>”;
echo “<form action=”index.php”>
<input type=”radio” value=”default” name=”default”>Default</option>
<input type=”radio” value=”black” name=”black”>Black</option>
<input type=”radio” value=”purple” name=”purple”>Purple</option>
<input type=”radio” value=”white” name=”white”>White</option>
<input type=”submit” name=”Change Style” />
</form>”;
echo “<div class=”nav”><a href=”index.php”>Home</a> | <a href=”register.php”>Register</a> | <a href=”links.php”>Links</a> | <a href=”faq.php”>FAQ</a></div>”;
echo “</div>”;
echo “</body></html>”;
?>
One of four style sheets:
[code=php]
<?php
echo “<style type=”text/css”>
#forms { position:absolute;top:75px;left:200px;align:right;padding-bottom:5px;}
#text { position:absolute; top:75px; left:125px; align:left;}
.text2 { padding-top:8px;}
.forms2 { padding-bottom:6px;}
#login {position:absolute;top:100px;left:75%;}
.nav{position:absolute; top:75px; left:10%; right:10%; width:80%;background-color:#0099FF;text-align:right;a}
.input{width:100px;} </style>”;
?>
Now I know I’m missing something obvious, but could someone please point it out? Thanks. The only thing I can think of is that perhaps the page loads before it can call up the style sheet?