surework1
asked on
CSS with PHP
Hello,
I can't get the test.php file to change the color of the text. where did i do wrong?
css.php file:-
body {
background: <?php echo $bgColor; ?>;
color: <?php echo $textColour; ?>;
}
#content {
width: <?php echo $contentWidth; ?>px;
}
test.php file:-
<?php
header('content-type: text/css');
$contentWidth = 500;
$bgColour = '#C0FFEE';
$textColour = '#DECAFF';
$color='red';
$car='BMW';
?>
<html>
<head>
<link rel="stylesheet" href="css.php" type="text/css" media="screen" />
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
<?php echo "I have a $color $car"; // I have a red BMW
?>
</body>
</html>
I can't get the test.php file to change the color of the text. where did i do wrong?
css.php file:-
body {
background: <?php echo $bgColor; ?>;
color: <?php echo $textColour; ?>;
}
#content {
width: <?php echo $contentWidth; ?>px;
}
test.php file:-
<?php
header('content-type: text/css');
$contentWidth = 500;
$bgColour = '#C0FFEE';
$textColour = '#DECAFF';
$color='red';
$car='BMW';
?>
<html>
<head>
<link rel="stylesheet" href="css.php" type="text/css" media="screen" />
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
<?php echo "I have a $color $car"; // I have a red BMW
?>
</body>
</html>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.