This is supposed to change the background color the the user clicks submit

[php]

Untitled Document body { bgColor: <?= $_GET['color'] ?>; } Hello, <?= $_GET['username'] ?>! [/php] [code] Untitled Document body { background-color: <?= $_POST['color'] ?>; }

Your Output

<?php //retrieve all the variables

$basicText = filter_input(INPUT_POST, “basicText”);
$borderSize = filter_input(INPUT_POST, “borderSize”);
$sizeType = filter_input(INPUT_POST, “sizeType”);
$borderStyle = filter_input(INPUT_POST, “borderStyle”);
$theStyle = <<<HERE
“border-width:$borderSize$sizeType;
border-style:$borderStyle;
border-color:green”
HERE;
print “

”;
print $basicText;
print “
”;
?>
[/code]

change:
body { bgColor: <?= $_GET['color'] ?>; }

to:
body { background-color: <?= $_GET['color'] ?>; }

Red :wink:

your php needs to go on top of the page if you want it to affect styles.

Sponsor our Newsletter | Privacy Policy | Terms of Service