Change the color of the table row based on a database value

0

Good afternoon

I'm building a system, which registers people in the database, and I need to, when I select a radio box on the page visita_registro.php that makes me include a record in the database, strong> id of the selected color and the data that appears in the table of page index.php remain the color I selected in the radio box on the previous page.

The colors are green, yellow, red and white. I have read an article that is similar to what I want to do but the script did not work out in my project.

If someone can help me, the explanation is kind of complex, but I hope you understand.

Part of the file visita_registro.php

<div class="panel panel-default">
        <div class="panel-heading">
            <p><span class="glyphicon glyphicon-comment"></span> Registro de Visitas</p>
        </div>
            <div class="panel-body">
                <form method="POST" action="visita_processa.php">
                    <!--Criando uma tag input com campo tipo hidden para enviar o id da linha que está em edição de forma oculta para o nosso arquivos de update -->
                    <input type="hidden" name="id" value="<?php echo $id; ?>">
                        <div class="form-group" class="styled-select">
                            <label for="pa">Situação:</label><br/>
                                <select name="situacao" class="form-control" >
                                    <option value="">Escolha o usuário</option>
                                    <?php
                                                $sql_at = "SELECT 
                                                            *
                                                             FROM 
                                                             rede_catarina.visitas_situacao
                                                            ORDER BY
                                                             id";

//Verifica se a consulta retornou mais de uma linha, se sim, mostra o conteúdo do banco,
                                                    $result_sql_at = mysqli_query($conn, $sql_at);
                                                        while($row_sql_at = mysqli_fetch_assoc($result_sql_at) ) {
                                                        echo '<option value="'.$row_sql_at['id'].'">'.utf8_encode($row_sql_at['situacao'].'</option>');

                                                        }
                                            ?>
                                </select>
                        </div>
                            <div class="form-group">
                                <label for="mensagem">Obs. Visita:</label><br/>
                                <textarea name="mensagem" class="form-control" rows="5" ></textarea><br/><br/>
                            </div>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" id="cor" name="cor" value="verde"> Visita Realizada<br>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" id="cor" name="cor" value="vermelho"> Visita com Alterações<br>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" id="cor" name="cor" value="amarelo"> Apreciado pelo Ministerio Público<br>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" id="cor" name="cor" value="branco"> Continuar Visitas<br><br><br> 
                                <input type="submit" value="Registrar" class="btn btn-primary" />
                </form>
        </div>
    </div>
    
asked by anonymous 14.07.2018 / 20:30

0 answers