1
I have a table
with a list of registered debtors
I want to rule him out if he pays.
With a base I managed to create the function and everything, but when I update the page, it comes back.
<!-- FAZ A FUNÇÃO DE SALVAR OS DADOS -->
<?php
header('Content-Type: text/html; charset=iso-8859-1');
setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
date_default_timezone_set('America/Sao_Paulo');
$nome = $_POST['nome'];
$produto = $_POST['produto'];
$banco = "nova.txt";
if($_POST['acao'] == "CADASTRAR")
{
if(empty($nome)){echo"<script>window.location='cadastro.php';alert('Nome em branco!');</script>";}
elseif(empty($produto)){echo"<script>window.location='cadastro.php';alert('Selecione a venda!');</script>";}
else
{
$data = strftime('%A, %d de %B de %Y', strtotime('today'));
$arquivo = fopen("$banco","r");
$while = fread($arquivo,filesize($banco));
fclose($arquivo);
$abrir = fopen("$banco","w");
if($while == "0"){$salvar ="<table class='lista-clientes' width='100%'>
<tbody>
<tr>
<td align='center'></td>
<td>
<select class='select_styled'>
<option value=''>$nome</option>
<option value=''> Produto: $produto</option>
<option value=''>Compra dia, $data</option>
</select
</td>
</tr>
</tbody>
</table>
";}
else{$salvar ="<table class='lista-clientes' width='100%'>
<tbody>
<tr>
<td align='center'></td>
<td>
<select class='select_styled'>
<option value=''>$nome</option>
<option value=''> Produto: $produto</option>
<option value=''>Compra dia, $data</option>
</select>
</td>
</tr>
</tbody>
</table>
$while";}
fwrite($abrir,"$salvar");
fclose($abrir);
echo"<script>window.location='cadastro.php';alert('Cadastrado com Sucesso!');</script>";
}}
?>
<!-- FAZ A FUNÇÃO DE ABRIR OS DADOS-->
<?php
$arquivo = fopen($banco,"r");
$while = fread($arquivo,filesize($banco));
if($while == "0"){echo"<br><br><br><br><center><font face=verdana size=1>Nenhum recado inserido!</font></center><br><br><br><br>";}else{echo"<font face=verdana size=1>$while</font>";}
fclose($arquivo);?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
(function($) {
RemoveTableRow = function(handler) {
var tr = $(handler).closest('table');
tr.fadeOut(400, function(){
tr.remove();
});
return false;
};
})(jQuery);
</script>
<!-- faz a funçao de salvar os dados -->
<?php
header('Content-Type: text/html; charset=iso-8859-1');
setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
date_default_timezone_set('America/Sao_Paulo');
$nome = $_POST['nome'];
$produto = $_POST['produto'];
$banco = "nova.txt";
if($_POST['acao'] == "CADASTRAR")
{
if(empty($nome)){echo"<script>window.location='cadastro.php';alert('Nome em branco!');</script>";}
elseif(empty($produto)){echo"<script>window.location='cadastro.php';alert('Selecione a venda!');</script>";}
else
{
$data = strftime('%A, %d de %B de %Y', strtotime('today'));
$arquivo = fopen("$banco","r");
$while = fread($arquivo,filesize($banco));
fclose($arquivo);
$abrir = fopen("$banco","w");
if($while == "0"){$salvar ="<table class='lista-clientes' width='100%'>
<tbody>
<tr>
<td align='center'></td>
<td>
<select class='select_styled'>
<option value=''>$nome</option>
<option value=''> Produto: $produto</option>
<option value=''>Compra dia, $data</option>
</select
</td>
</tr>
</tbody>
</table>
";}
else{$salvar ="<table class='lista-clientes' width='100%'>
<tbody>
<tr>
<td align='center'></td>
<td>
<select class='select_styled'>
<option value=''>$nome</option>
<option value=''> Produto: $produto</option>
<option value=''>Compra dia, $data</option>
</select>
</td>
</tr>
</tbody>
</table>
$while";}
fwrite($abrir,"$salvar");
fclose($abrir);
echo"<script>window.location='cadastro.php';alert('Cadastrado com Sucesso!');</script>";
}}
?>
<!-- faz a função de abrir os dados -->
<?php
$arquivo = fopen($banco,"r");
$while = fread($arquivo,filesize($banco));
if($while == "0"){echo"<br><br><br><br><center><font face=verdana size=1>Nenhum recado inserido!</font></center><br><br><br><br>";}else{echo"<font face=verdana size=1>$while</font>";}
fclose($arquivo);?>
I want to delete permanent or there is no way by Jquery?
You have to delete on the server... it’s not enough to delete on the browser. Where does this debtor list come from?
– Sergio
How simple is the dynamic in this I saved only in a text file and I call him on the site that sample this list.
– Léo Andrade
But even that text file is on the right server? because you can’t save files with the browser.
– Sergio
yes, only that it saves all the records in the same file.
– Léo Andrade
You can show the code you use when you use?
– Sergio
there is another way for me to put the code here on the site but specified?
– Léo Andrade
Edit the question that gets better ;)
– Victor Tadashi
I still can’t ask right here, but I put all the dynamic used to save the data and show.
– Léo Andrade
running only as shown. http://quetalumapizza.esy.es/lista_obligores.php
– Léo Andrade