1
I have a list of clients each in a cell.
I want, by clicking on the cell, send to another page the id
of the selected client, safely. Without showing the id in the link.
Generating the tables:
$marcador = '<img src="../imagens/traco.png" width="5px" height="13px"> ';
//Iniciando tabela
echo '<table>';
//Mostrando em uma tabela
foreach ($clientes as $cliente) {
//Linha da tabela
echo '<tr>';
//Celula da tabela
//Nome do cliente, recebe cor diferente
echo '<td><a href="meuendereco/outrapagina"><span class="nome">' . $cliente->getNome() . '</span><br>'
. $cliente->getFantasia() . '<br>'
. $marcador . 'Cód.: ' . $cliente->get_id() . '<br>'
. $marcador . $cliente->getEnderco() . ', ' . $cliente->getNum() . '<br>'
. $marcador . $cliente->getBairro() . ' - ' . $cliente->getCidade() . ', ' . $cliente->getUf() . '</a></td>';
}
Man CSS For my sake css I made a cell to be like a link.
@charset "utf-8";
/* CSS Document */
/* CORPO DA PÁGINA */
body {
color:#666; /* cor padrão para todas fontes */
font-weight: bold; /* negrito */
}
/********************* TABELA **********************************/
/* linha da tabela*/
table, td {
padding-left: 15px;
padding-top: 3mm; /* distancia do topo */
padding-bottom: 1.5mm; /* distancia da base*/
border-collapse: collapse; /* Borda simples */
border-bottom: 1px solid green; /* Borda de baixo */
border-bottom-color: #666; /* cor da borda de baixo */
}
/* espaço da celula */
td:hover{
background: #C6E2FF; /*cor de fundo da celula*/
cursor: pointer; /*cursor na celular será uma mãozinha*/
}
/* link na célula */
td a{
text-decoration:none; /* texto não ficará sumblinhado na tabela*/
display: block; /* link será na célula */
height: 100%; /* link será em toda célula*/
color:#666; /* a cor do texto será (cinza)*/
}
/******************* FIM - TABELA ******************************/
/* cor do nome dos clientes*/
.nome {
font-size: 18px; /* tamanho da fonte */
color:#6699CC; /* cor da fonte */
font-weight: bold; /* fonte em negrito */
}
On line 10 of the code you posted, pass the ID of the client by
GET
thus<a href="meuendereco/outrapagina?cliente_id=' . $cliente->get_id() . '">
– Erlon Charles
Only this way the id is visible in the link. I want to avoid this. There is another way?
– Alysson
Actually this is not much problem no, because even sending by
POST
it is possible to view the data sent on request, but if it makes a big difference to you, use aform
in each cell it is possible to send the id to the other page.– Erlon Charles
Why do you want to hide the customer ID? What is the threat you want to defend against?
– user25930
You’re right, I don’t need to hide the client ID, but if I need to, I’ll make a form in the cell itself. Thank you.
– Alysson