Link to home
Start Free TrialLog in
Avatar of surework1
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>
SOLUTION
Avatar of Ahmed Merghani
Ahmed Merghani
Flag of Sudan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial