mardi 2 novembre 2021

(Codeigniter) Echo result in view automatic input to database

I want echo from if/else conditions(NEW, ALERT, ACTIVE, EXPIRED) automatic input to tr_status coloumn in database. What should i do?coloumn picture phpmyadmin

        <td>
        <?php
        $today   = Date("Y-m-d");
        $months  = Date("Y-m-d", strtotime('+180 days'));   
        if ($t->tr_no == NULL) {
        echo '<span style="color: #20B2AA; font-weight: bold; ">NEW</span>';
        }

        elseif ($t->tr_exp <= $today) {
        echo '<span style=" color: red; font-weight: bold; ">EXPIRED</span>';
        }

        elseif ($t->tr_exp <= $months) {
        echo '<span style="font-weight: bold; color: ORANGE;">ALERT</span>';
        }
        
        else {
        echo '<span style="font-weight: bold; color: #4DBE24;">ACTIVE</span>';
        }
        ?>    
        </td>

Aucun commentaire:

Enregistrer un commentaire