Jump to content

Highlight values


Schlo_50

Recommended Posts

Hey guys,

 

I have some values pulled from a .txt file which are echo'ed out on a page. E.g

 

Value1, Value2, Value3, Value4

 

What i'd like to do is get some code to highlight each output in this order: red, yellow and blue. E.g

 

Red    | Yellow | Blue  | Red

Value1 | Value2 | Value3 | Value4

 

 

I have so far attempted this but need some help/ideas about what to try next?

$lines = file("file.txt"); //open file
  foreach ($lines as $line) { 
$data[$key] = explode("|", $line);

	$catname = trim($data[$key][1]); //define data needed


$a = "<font style=\"background-color: red\" size=\"3\">"; //red html highlight
$b = "<font style=\"background-color: yellow\" size=\"3\">"; //yellow html highlight
$c = "<font style=\"background-color: blue\" size=\"3\">"; //blue html highlight

$array = array($a, $b, $c); //i think i need to use a array?

print '<strong>'.$catname.'</strong></font>'; // print values and html highlight

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/90503-highlight-values/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.