This topic is locked

The background color of the record depends on the text value

2/28/2020 5:12:47 PM
PHPRunner General questions
kanclerz author

Welcome

I have a "order status" field in the database whose values are not a number but a closed selection list, e.g. (To be accepted, accepted, to be improved) I would like the background of the entire record to be in a specific color depending on the status selected, but as I do with the tutorial , the records are still colorless

if ($data["status"] == "Do akceptacji")

{

$record["status_style"].='style="background:red"';

}

elseif ($data["status"] == "Zaakceptowano")

{

$record["status_style"].='style="background:blue"';

}

elseif ($data["status"] == "Do poprawy")

{

$record["status_style"].='style="background:green"';

}
W
WilliamBDevClub member 2/28/2020

Try



if ($data["status"] == "Do akceptacji")

$record["status_style"].='style="background:red"';
if ($data["status"] == "Zaakceptowano")

$record["status_style"].='style="background:blue"';
if ($data["status"] == "Do poprawy")

$record["status_style"].='style="background:green"';