0
I have the following problem, I need to validate the deletion of a field, and I am doing this via modal of the globe bootstrap. However the field comes from a table and accurate enough in the modal two information, the client code to be deleted and the type of this client to delete in the database.
Both are on the same page, however I give a include on the page listing in a table all customers.
How do I get this code sent to the modal ?
My codes:
Mymodal:
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Tem certeza que deseja excluir este contato ?</h4>
</div>
<div class="modal-body" align="center">
<form action="C_DeletaCliente.php" method="get">
<?php
$cdCli = $_GET['P_COD_IDENT_CLIEN'];
$tipo = $_GET['P_FLG_TIPOX_CLIEN'];
echo $cdCli+","+$tipo;
?>
<button type="submit" class="btn btn-default"><a> Sim</a></button>
</form>
<button type="submit" data-dismiss="modal" class="btn btn-default"><a> Não</a></button>
</div>
</div>
</div>
</div>
Lista Clientes:
// executa query de consulta e armazena o resultado devolvido na variável $resultado
$resultado = mysql_query("SELECT COD_IDENT_CLIEN, TXT_NOMEX_CLIEN, FLG_TIPOX_CLIEN, FLG_IDENT_STATU from tbl_CLIENTES ORDER BY FLG_TIPOX_CLIEN, TXT_NOMEX_CLIEN ASC");
// se não existir cargos cadastrados exibe uma mensagem
if (mysql_num_rows($resultado) <= 0) {
echo "<div class='alert alert-error'>";
echo "<b>Atenção!</b><br>";
echo "Não existe clientes cadastrados no momento.";
echo "</div>";
}
// se existir produtos cadastrados lista-os
else {
echo "<table class='lista-clientes table table-striped'>";
echo "<thead>";
echo "<th>Nome do Cliente</th>";
echo "<th>Tipo de Cliente</th>";
echo "<th>Status do Cliente</th>";
echo "<th>Excluir</th>";
echo "<th>Alterar</th>";
echo "<th>Uploads</th>";
echo "<th>Agenda</th>";
echo "<th>Publicações</th>";
echo "<th>Recados</th>";
echo "</thead>";
while ($linha = mysql_fetch_array($resultado)) {
echo "<tr>";
echo "<td>$linha[1]</td>";
switch ($linha[2]) {
case 'F':
echo "<td>Pessoa Fisica</td>";
break;
case 'J':
echo "<td>Pessoa Juridica</td>";
break;
default:
echo "<td>Não cadastrado</td>";
break;
}
switch (@$linha[FLG_IDENT_STATU]) {
case 'A':
echo "<td>Ativo</td>";
break;
case 'I':
echo "<td>Inativo</td>";
break;
default:
echo "<td>Não cadastrado</td>";
break;
}
echo "<td><a href='#myModal2?P_COD_IDENT_CLIEN={$linha[0]}&P_FLG_TIPOX_CLIEN={$linha[2]}' data-toggle=\"modal\" data-target=\"#myModal2\"><i class='icon-remove' ></i></a></td>";
switch ($linha[2]) {
case 'F':
echo "<td><a href='alteraPF.php?P_COD_IDENT_CLIEN={$linha[0]}'><i class='icon-pencil' ></i></a></td>";
break;
case 'J':
echo "<td><a href='alteraPJ.php?P_COD_IDENT_CLIEN={$linha[0]}'><i class='icon-pencil' ></i></a></td>";
break;
}
echo "<td><a href='uploadCliente.php?P_COD_IDENT_CLIEN={$linha[0]}'><i class='icon-upload-alt' ></i></a></td>";
echo "<td><a href='agendaCliente.php?P_COD_IDENT_CLIEN={$linha[0]}'><i class='icon-calendar' ></i></a></td>";
switch ($linha[2]) {
case 'F':
echo "<td><a href='publicacaoPF.php?P_COD_IDENT_CLIEN={$linha[0]}'><i class='icon-file' ></i></a></td>";
break;
case 'J':
echo "<td><a href='publicacaoPJ.php?P_COD_IDENT_CLIEN={$linha[0]}'><i class='icon-file' ></i></a></td>";
break;
}
echo "<td><a href='listaRecadosClientes.php?P_COD_IDENT_CLIEN={$linha[0]}'><i class='icon-inbox' ></i></a></td>";
echo "</tr>";
}
echo "</table>";
}
The purpose of this question is to try to do something to validate the deletion of the field if there is any more effective way, or easier to develop accepted statements.
What do you call this modal? It is an external file or is on the same page?
– KaduAmaral
It’s on the same page, and the way to call it is when I click the X button, it fires an event through the data-toggle="modal".
– Renan Rodrigues