Jump to content

echo out Happy Anniversary! in red


Scotty13

Recommended Posts

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

?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...