Scotty13 Posted August 23, 2012 Report Share Posted August 23, 2012 I’m building a member page and when it reaches there anniversary date. I want “Happy Anniversary” to display in red. Currently it displays in black. Code below… <?php /*$sDayMSG = ""; $today = date("Y-m-d");// today would be 2010-10-09 // Query database for user data $seniority = $row['seniority']; if ($today == $seniority) {// Evaluate if they match today $sDayMSG = "Happy Anniversary!"; }*/ // Now convert for display like normal here $seniority = strftime("%b. %d, %Y", strtotime($seniority)); //echo $sDayMSG; // Wherever you need it on the page ?> Quote Link to comment Share on other sites More sharing options...
Andrea Posted August 23, 2012 Report Share Posted August 23, 2012 Look at the source code of the page that displays this text and see what the codes around it are - then change to color to the appropriate tags to red. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 23, 2012 Report Share Posted August 23, 2012 Andrea's correct -- this would be a HTML/CSS change, not a PHP change. For example, you might need to do something like this: <div class="red"><?php echo $sDayMSG; ?></div> where the .class has the text color set to red. Quote Link to comment Share on other sites More sharing options...
khanahk Posted August 23, 2012 Report Share Posted August 23, 2012 If you want to do it in-line with the PHP, which isn't generally good practice, you can change $sDayMSG = "Happy Anniversary!"; to $sDayMSG = '<span style="color: #FF0000;">Happy Anniversary!</span>'; Otherwise do what these other folks are talking about Quote Link to comment Share on other sites More sharing options...
Scotty13 Posted August 23, 2012 Author Report Share Posted August 23, 2012 Thanks everyone. Quote Link to comment 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.
Note: Your post will require moderator approval before it will be visible.