sac0o01 Posted April 28, 2012 Share Posted April 28, 2012 I am working on a chatbox script and am using html to set the colors for the text. First in config.php I define the values for the colors: //Name color (sets color of name in messages) $nametextcolor = "6b9c69"; //Message text color (sets color of messages) $messagetextcolor = "FF9900"; Then I use the variables in the html code: <div class="<? echo $class; ?>" style="background-color:<? echo $bgcolor; ?>"> <font color="<? echo $nametextcolor; ?>" > <? echo $name; ?>: </font> <font color="<? echo $messagetextcolor; ?>" > <? echo $text; ?></font> </div> The problem is it does not change the color of $name only change the return for $text Is there something I am missing here? Quote Link to comment https://forums.phpfreaks.com/topic/261760-help-using-php-within-html/ Share on other sites More sharing options...
QuickOldCar Posted April 28, 2012 Share Posted April 28, 2012 I tried your code and I see both colors, not sure why it wouldn't work for you. Some things you should know: The <font> tag is deprecated in HTML 4, and removed from HTML5. The World Wide Web Consortium (W3C) has removed the <font> tag from its recommendations. In HTML 4, style sheets (CSS) should be used to define the layout and display properties for many HTML elements. You should be using full php tags and not short, use <?php versus <? A few helpful places to start learning css: http://www.w3.org/Style/Examples/011/firstcss.en.html http://www.tizag.com/cssT/ http://www.csstutorial.net/ http://htmlhelp.com/reference/css/ http://www.alistapart.com/topics/code/css/ http://www.cssbasics.com/ http://meyerweb.com/eric/css/ http://www.456bereastreet.com/archive/categories/css/ http://www.htmldog.com/ http://www.barelyfitz.com/screencast/html-training/css/positioning/ http://www.w3schools.com/css/default.asp Quote Link to comment https://forums.phpfreaks.com/topic/261760-help-using-php-within-html/#findComment-1341362 Share on other sites More sharing options...
plznty Posted April 28, 2012 Share Posted April 28, 2012 font colors start with a # for example #FFFFFF Quote Link to comment https://forums.phpfreaks.com/topic/261760-help-using-php-within-html/#findComment-1341368 Share on other sites More sharing options...
Drummin Posted April 28, 2012 Share Posted April 28, 2012 Don't use short tags, <? ?> Use full tags, <?php ?> Quote Link to comment https://forums.phpfreaks.com/topic/261760-help-using-php-within-html/#findComment-1341372 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.