bobk Posted April 8, 2009 Share Posted April 8, 2009 just wondering how some1 would edit php code for text's ? example : print "Your email has been removed from our mailing list. "; how would i make it print it in a diffrent color. as if i add some html in between the " " it doesnt work ? print "<font color="#ffffff">Your email<br /> has been removed from our mailing list. </font>"; bascailly its coming out in black font, but i want it in white. and no html/css i can think of will edit it . as its in a php file. thanks. Link to comment https://forums.phpfreaks.com/topic/153088-php-basic-help/ Share on other sites More sharing options...
genericnumber1 Posted April 8, 2009 Share Posted April 8, 2009 The reason it doesn't work is apparent when you use syntax highlighting: <?php print "<font color="#ffffff">Your email<br /> has been removed from our mailing list. </font>"; You have to escape those inner quotes with a backslash or you could just use single quotes on the outside since there are no variables in the string. <?php print '<font color="#ffffff">Your email<br /> has been removed from our mailing list. </font>'; Link to comment https://forums.phpfreaks.com/topic/153088-php-basic-help/#findComment-804109 Share on other sites More sharing options...
bobk Posted April 8, 2009 Author Share Posted April 8, 2009 ahah! alot of people use " " aswell. =\ and sometimes like the break tag in html works, thanks tho, works good Link to comment https://forums.phpfreaks.com/topic/153088-php-basic-help/#findComment-804111 Share on other sites More sharing options...
Philip Posted April 8, 2009 Share Posted April 8, 2009 Escaping them would look like: print "<font color=\"#ffffff\">Your email<br /> has been removed from our mailing list. </font>"; Link to comment https://forums.phpfreaks.com/topic/153088-php-basic-help/#findComment-804145 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 I prefer using double quotes for the string and single quotes for the attributes. Reason being, it's a good practice if you need variables to interpolate in the string, as generic mentioned. Link to comment https://forums.phpfreaks.com/topic/153088-php-basic-help/#findComment-804149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.