Get Foreach ID on same page with session

0

Next, I'm working on a way to update the notification date in the database, but to update that date I need the record ID. I can bring the ID of the database without problem, the problem is when the guy clicks the div, I do not know how to identify the id in which he clicked. I tried to use $ _Session (I did it once so it just sends it to another page, then it rolled), however it is overriding the values in the variable. (The id is that of the registry, not the Div).

Codes:

    foreach ($notificacoes as $notificacao): 
    ?>    

    <center>
    <?php
        echo $notificacao['datareg'];
        if(!empty($notificacao['datareg'])){
            echo '<div id="'. $div . $cont . '" class="visualizado" onclick="visualizarNt()">';
        } else {
            echo '<div id="'. $div . $cont .'" class="naovisualizado" onclick="visualizarNt()">';
        }                                                                                            
    ?>       
            <table border = "1">

                <tr>
                    <td>Foto</td>
                    <td>Nome</td>
                    <td>Sobrenome</td>
                    <td>Detalhes</td>
                    <td>Data esperada</td>
                    <td>Perfil</td>
                    <td>Cancelar</td>
                    <?php
                    if ($notificacao['estadoContrato'] != 'ConfirmadoTecnico') {
                        echo '<td>Atualizar</td>';
                    }
                    ?>
                </tr>
                <tr>
                    <td><img src="<?php echo $notificacao['foto'] ?>" width="40px" height="40px"</td>
                    <td><?php echo $notificacao['nome'] ?></td>
                    <td><?php echo $notificacao['sobrenome'] ?></td>
                    <td><?php echo $notificacao['detalhes'] ?></td>                    
                    <td><?php echo $notificacao['data_acertada'] ?></td>
                    <td><a href="pag_perfilAbertoTec.php">Visitar</a></td>
                    <td><a href="" onclick="cancelar(); return false;">Cancelar</a></td>
                    <?php
                    if ($notificacao['estadoContrato'] != 'ConfirmadoTecnico') {
                        echo '<td><a href="" onclick="atualizar(); return false;">Confirmar</a></td>';
                    }

                    $_SESSION['idContrato'] = $_SESSION['datareg'];
                    // Tentei assim, mas ele está sobrepondo..
                    ?>
                </tr>
            </table>
            <?php $cont++; ?>
        </div></center>
    <?php
endforeach;
    
asked by anonymous 28.05.2018 / 03:48

0 answers