I have a PHP index page where data from an array is being displayed inside <div>‘s on top of a picture. I want the <div>‘s to change color based on the content inside it.
The idea is this:
I have Customer - Date - Due in
The array I mean has a structure like the following:
Array(
[0] => array('customer' => 'John', 'date' => '2012-05-11', 'due' => 9),
[1] => array('customer' => 'Hess', 'date' => '2011-12-11', 'due' => 5),
[2] => array('customer' => 'Mrac', 'date' => '2012-06-18', 'due' => 3)
)
Due in shows a number of days – I want the <div> to be red if the number inside it is 5 or lower.
Any help would be greatly appreciated.
Within the php code, give the div a different class if “Due in” is less than or equal to 5.
So in your PHP, when you’re looping through your array:
so that the following gets output when there’s less than 5 days:
And then css: