oi fiz um programa que faz o seguinte—>cadastra usuario no banco de dados ,faz algumas validações ,mostra um tabela com todos os registros já cadastrados cada um com um botao radio para o usuario clicar e deletar esse registro …só que o problema é que não ta excluindo não sei o que ta errado
alguem pode me ajudar???
[code]
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="estilo.css" >
</head>
<?php
include ("conectabanco.php");
$nome= $_POST["nome"];
$email= $_POST["email"];
$senha= $_POST["senha"];
$sql2= "SELECT *FROM cadastrar WHERE nome='$nome' AND email='$email' AND senha='$senha'";
$mysql_result=mysql_query($sql2,$base);
if(substr_count($email,"@")==0|| substr_count($email,".")==0){
echo"<div align=center >por favor ,utilize um e-mail válido</p>";
echo "<a href='index.html'>voltar</a></div>";
exit;
}
$num_rows= mysql_num_rows($mysql_result);
if($num_rows!=0){
echo"<div align=center>cadastro duplicado,escolha outro dado" ;
echo "<br>"; echo "<a href='index.html'>voltar</a></div>";
exit;
}
else{
$sql = "INSERT INTO cadastrar(nome, email, senha) VALUE('".$nome."','".$email."','".$senha."')";
$resultado = mysql_query($sql) or die (mysql_error());
$sql = "SELECT * FROM cadastrar";
$resultado = mysql_query($sql) or die (mysql_error());
echo "<div align='center'><table border='1' id='cor2'>
<thead id=cor>
<tr width=800>
<td width=200>REGISTRO</td>
<td width=200>NOME</td>
<td width=200>E-MAIL</td>
<td width=200>SENHA</td>
<td width=200>DELETAR</td>
</tr>
</head>
</table></div>";
$pa = 0;
while ($linha = mysql_fetch_array($resultado)) {
$id[] = $linha;
$idao = $id[$pa]["id"];
$nome = $id[$pa]["nome"];
$email = $id[$pa]["email"];
$senha = $id[$pa]["senha"];
echo "<div align='center'><table border='1' id='cor2'>
<tbody id=cor2>
<tr width=800>
<td width=200>$idao</td>
<td width=200>$nome</td>
<td width=200>$email</td>
<td width=200>$senha</td>
<td width=200><form action='excluir.php' method='post'><input type='radio' name='selection' value='$id' id=oi/></form></td>
</tr>
</tbody>
</table></div>";
$pa++;
}
echo"<div align=center>
<form id ='fo' name ='for' action='excluir.php' method='pos't>
<table border=1 id=cor2>
<tbody id=cor2>
<tr width=800>
<td width=820></td>
<td width=200><input type='submit' name='deletar' value='excluir'></td>
</tr>
</tbody>
</table>
</form></div>";
echo "<p align=center><a href='index.html'>voltar</a></p>";
}
?>
</body>
</html>
[/code]
excluir.php
<?php
include ("conectabanco.php");
if(isset($_POST["selection"]))
{
$reul=mysql_query("DELETE FROM cadastrar WHERE id IN (".implode(",",$_POST["selection"]).")");
header("refresh:0");
}
if($reul){
echo"campos deletados com sucesso!";
}
else{
echo"campos não deletados com sucesso!";
}
?>