<?php include "config.php"; $nome = $_POST['nome']; $email = $_POST['email']; if ($opcao == 'cad') { if( eregi('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+\.'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email) ) { $cadastrar = mysql_query("INSERT INTO news (nome, email) VALUES ('$nome', '$email')", $db); } if( $email ) { echo "<script>window.alert('Email cadastrado com sucesso.'); </script>"; echo "<script>window.location = 'javascript:history.go(-1);'</script>"; } else { echo "<script>window.alert('Houve um erro ao tentar cadastrar seu email. Tente novamente!'); </script>"; echo "<script>window.location = 'javascript:history.go(-1);'</script>"; } } if ($opcao == 'del') { $del = mysql_query("DELETE from news (nome, email) VALUES ('$nome', '$email')", $db); } ?>eu ja tentei d td, os campos, tem o mesmo nome, mas a pag fik em branco...
pag q cadastra:
<html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <form action="cad.php" method="post"> <table width="100%" border="0" cellspacing="2" cellpadding="2"> <tr> <td width="12%"><font size="1" face="Verdana">Seu Nome:</font></td> <td width="88%"><font size="1" face="Verdana"> <input name="nome" type="text" id="nome" class="f1"> </font></td> </tr> <tr> <td><font size="1" face="Verdana">Seu E-mail:</font></td> <td><font size="1" face="Verdana"> <input name="email" type="text" id="email" class="f1"> </font></td> </tr> <tr> <td> </td> <td><input name="opcao" type="radio" value="cad"><font size="2">Cadastrar</font></td> </tr> <tr> <td> </td> <td><input name="opcao" type="radio" value="del"><font size="2">Descadastrar</font></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Cadastrar" class="f1"></td> </tr> </table> </form> </body> </html>faz um mes q n consigo, nem com a documentacao do php eu consegui...