KDragon Posted April 23, 2006 Share Posted April 23, 2006 Why isn't the text this document displays, white? I have a variable representing each value of the rgb specification of the color white. I set the variable to 255 but the text always shows up black. Can anybody please explain why? Here's the code:[code]<?php $colorNum=255; ?><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><p style="color: rgb(<?php $colorNum; ?>,<?php $colorNum; ?>,<?php $colorNum; ?>);">This be some text.</p></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/8155-variable-not-keeping-value/ Share on other sites More sharing options...
mb81 Posted April 23, 2006 Share Posted April 23, 2006 [!--quoteo(post=367613:date=Apr 23 2006, 12:59 AM:name=KDragon)--][div class=\'quotetop\']QUOTE(KDragon @ Apr 23 2006, 12:59 AM) [snapback]367613[/snapback][/div][div class=\'quotemain\'][!--quotec--]Why isn't the text this document displays, white? I have a variable representing each value of the rgb specification of the color white. I set the variable to 255 but the text always shows up black. Can anybody please explain why? Here's the code:[code]<?php $colorNum=255; ?><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><p style="color: rgb(<?php $colorNum; ?>,<?php $colorNum; ?>,<?php $colorNum; ?>);">This be some text.</p></body></html>[/code][/quote]My bet would be that if you view the source of the file, it will look like this:[code]<p style="color: rgb(,,);">This be some text.</p>[/code]Change your line to this:[code]<p style="color: rgb(<?php echo $colorNum; ?>,<?php echo $colorNum; ?>,<?php echo $colorNum; ?>);">This be some text.</p>[/code]and it should work. Link to comment https://forums.phpfreaks.com/topic/8155-variable-not-keeping-value/#findComment-29749 Share on other sites More sharing options...
KDragon Posted April 23, 2006 Author Share Posted April 23, 2006 [!--quoteo(post=367618:date=Apr 23 2006, 01:31 AM:name=mb81)--][div class=\'quotetop\']QUOTE(mb81 @ Apr 23 2006, 01:31 AM) [snapback]367618[/snapback][/div][div class=\'quotemain\'][!--quotec--]My bet would be that if you view the source of the file, it will look like this:[code]<p style="color: rgb(,,);">This be some text.</p>[/code]Change your line to this:[code]<p style="color: rgb(<?php echo $colorNum; ?>,<?php echo $colorNum; ?>,<?php echo $colorNum; ?>);">This be some text.</p>[/code]and it should work.[/quote]Oh gosh I'm dumb. I'm sorry :(. My brain must be totally just ahhh today. Thank you for your help. Link to comment https://forums.phpfreaks.com/topic/8155-variable-not-keeping-value/#findComment-29750 Share on other sites More sharing options...
kenrbnsn Posted April 23, 2006 Share Posted April 23, 2006 Unless you change the backgroud-color of the body, this text will not be seen.Ken Link to comment https://forums.phpfreaks.com/topic/8155-variable-not-keeping-value/#findComment-29751 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.