Could someone lend me a hand? (PHP + HTML)

Hey! I’m trying to use some data on a PHP table to display different buttons on my website, but I’m facing some issues when trying to do this. Here is my HTML code and some screenshots:

<td><button class="btn btn-<?php if($array->usr_status == Pendente){ echo "warning";}else if($array->usr_status == Ativo){echo "success";}else{echo "danger";}; ?>"><i class="fas fa-<?php if($array->usr_status == Pendente){ echo "circle-question";}else if($array->usr_status == Ativo){echo "circle-check";}else{echo "circle-xmark";}; ?>"></i></button></td>

I’d like that these buttons under Status column display different colors and icons for different values on the column marked with red on the PHP table.
Basically, it should be red with a xmark if the value is “Negado”; green with a checkmark if the value is “Ativo” and yellow with a question mark if the value is “Pendente”. I really don’t know what I’m missing in the code. (I’m a newbie, don’t judge me hahahaha)

Thanks in advance :slight_smile:

Here is the screenshot of what I’m meaning. Regardless of the value of the column, all buttons are red…

it seems that you are trying to generate buttons dynamically based on the $array->usr_status value. However, there are a few syntax errors in your code. Here’s a corrected version of the code:

:::::::::: In PHP, string values should be enclosed in quotes. Therefore, you should use 'Pendente' , 'Ativo' , etc., instead of just Pendente , Ativo , etc., in your conditionals:
With these corrections, the button class and icon class will be dynamically generated based on the value of $array->usr_status .

i will be happy if i hear you code is working!.

idk if you are not seeing the code just contact me at “[email protected]