tenho o formulario abaixo para importação de informaçoes para o banco e gostaria que quando fosse lançado uma informação de CPF e este CPF já estive-se no banco de dados o sistema envia-se ao usuario uma mensagem informando que já existe e perguntado se ele gostaria de continuar a carregar os dados.
alguém podem me ajudar?
<?php //arquivo de conexão com o banco de dados require('conecta.php'); //pegando variáveis $filial = $_POST ['filial']; $regional = $_POST ['regional']; $pedido = $_POST ['pedido']; $data = $_POST ['data']; $hora = strftime('%H:%M:S'); $acesso = $_POST ['acesso']; $cliente = $_POST ['cliente']; $cpf = $_POST ['cpf']; $plano = $_POST ['plano']; $backoffice = $_POST ['backoffice']; //inserindo dados na tabela livrodevisitas $sqlinsert = "INSERT INTO livrodevisitas (filial, regional, pedido, data, hora, acesso, cliente, cpf, plano, backoffice) VALUES ('$filial', '$regional', '$pedido', '$data', '$hora', '$acesso', '$cliente', '$cpf', '$plano', '$backoffice')"; mysql_query($sqlinsert) or die ("Não foi possível inserir os dados"); echo" <html> <head> <meta http-equiv=\"Content-Language\" content=\"pt-br\"> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\"> <title>Sua venda foi enviada.</title> <link rel = \"stylesheet\" type = \"text/css\" href = \"css.css\" /> <style> <!-- .ms-simple1-main { border-left-style: none; border-right-style: none; border-top: 1.5pt solid green; border-bottom: 1.5pt solid green } .ms-simple1-tl { border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: .75pt solid green } .ms-simple1-left { border-style: none } .ms-simple1-even { border-style: none } --> </style> </head> <body> <p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\"> <hr size=\"1\" width=\"50%\"> <p align=\"center\" style=\"margin-top: 0; margin-bottom: 0\"> <font face=\"Century Gothic\" color=\"#008000\">Venda Enviada</font></p> <hr size=\"1\" width=\"50%\"> <div align=\"center\"> <table border=\"0\" width=\"51%\" id=\"table1\" class=\"ms-simple1-main\"> <!-- fpstyle: 1,011111100 --> <tr> <td colspan=\"2\" class=\"ms-simple1-tl\"> <font face=\"Century Gothic\" size=\"2\">Data: $data Hora: $hora</font></td> </tr> <tr> <td width=\26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">Filial</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$filial</td> </tr> <tr> <td width=\"26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">Regional</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$regional</td> </tr> <tr> <td width=\"26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">Pedido:</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$pedido</td> </tr> <tr> <td width=\"26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">Data:</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$data</td> </tr> <tr> <td width=\"26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">acesso:</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$acesso</td> </tr> <tr> <td width=\"26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">Cliente:</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$cliente</td> </tr> <tr> <td width=\"26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">CPF:</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$cpf</td> </tr> <tr> <td width=\"26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">Plano:</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$plano</td> </tr> <tr> <td width=\"26%\" class=\"ms-simple1-left\"> <font face=\"Century Gothic\" size=\"2\">Backoffice:</font></td> <td width=\"73%\" class=\"ms-simple1-even\">$backoffice</td> </tr> </table> </div> </body> </html>"; echo '<meta http-equiv="refresh" content="5;URL=vendas.php" /> ' //redirecionar ?>