Cadastro de fornecedores
Quando eu tento cadastrar um fornecedor aparece que foi cadastrado com sucerro, mas no banco não fica salvo
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
$titulo = "Controle » Cadastrar Fornecedor";
require_once ("includes/header.php");
?>
</head>
<body>
<?php
require_once('includes/testes.php');
//require_once('includes/db.php');
require 'includes/conn.php';
if ($_POST)
{
$nome = $_POST['produto'];
$contato = $_POST['contato'];
$cnpj = $_POST['cnpj'];
$rua = $_POST['rua'];
$bairro = $_POST['bairro'];
$cidade = $_POST['cidade'];
$estado = $_POST['uf'];
$fone2 = $_POST['fone2'];
$fone3 = $_POST['fone3'];
$site = $_POST['site'];
$cep = $_POST['cep'];
if ($nome != '' || $contato != '' || $cnpj != '' || $rua != '' || $bairro != '' || $cep != '' || $cidade != '' || $estado != '' || $fone2 != '' || $fone3 != '')
{
//$cad = mysql_query ("INSERT INTO fornec(id,NOME,CONTATO,CNPJ,RUA,BAIRRO,CIDADE,UF,CEP,FONE_2,FONE_3,SITE)
//values(NULL,'$nome','$contato','$cnpj','$rua','$bairro','$cidade','$estado','$cep','$fone2','$fone3','$site') ")
//or die (mysql_error());
$sql = "INSERT INTO fornec(id, NOME, CONTATO, CNPJ, RUA, BAIRRO, CIDADE, UF, CEP, FONE_2, FONE_3, SITE)
VALUES ('$nome','$contato','$cnpj','$rua','$bairro','$cidade','$estado','$cep','$fone2','$fone3','$site')";
$sql = mysqli_query($conne, $sql);
echo "<script>alert('Cadastro foi efetuado com sucesso');</script>";
}
}
?>
<div id="principal">
<form action="<?php $_SERVER['PHP_SELF']?>" method="post">
<fieldset>
<legend class="titulo">Cadastro de Fornecedor ↓ </legend>
<label>Empresa</label>
<input type="text" name="produto" maxlength="45" onfocus="this.style.backgroundColor='#fff';" onblur="this.style.backgroundColor='#EEE';"/><br />
<label>E-mail</label>
<input type="text" name="contato" maxlength="50"/><br />
<label>CNPJ</label>
<input type="text" name="cnpj" maxlength="14" /><br />
<label>Rua</label>
<input type="text" name="rua" maxlength="50" /><br />
<label>Bairro</label>
<input type="text" name="bairro" maxlength="50" /><br />
<label>Cidade</label>
<input type="text" name="cidade" maxlength="30" /><br />
<label>Estado</label>
<select name="uf">
<option>SP</option>
<option>PR</option>
<option>AC</option>
<option>AL</option>
<option>AM</option>
<option>AP</option>
<option>BA</option>
<option>CE</option>
<option>DF</option>
<option>ES</option>
<option>GO</option>
<option>MA</option>
<option>MG</option>
<option>MS</option>
<option>MT</option>
<option>PA</option>
<option>PB</option>
<option>PE</option>
<option>PI</option>
<option>RJ</option>
<option>RN</option>
<option>RO</option>
<option>RR</option>
<option>RS</option>
<option>SC</option>
<option>SE</option>
<option>TO</option>
</select><br />
<label>CEP</label>
<input class="camp" type="text" name="cep" size="9" maxlength="9" /><br />
<label>Telefone</label>
<input type="text" name="fone2" maxlength="14" /><br />
<label>Telefone 2</label>
<input type="text" name="fone3" maxlength="14" /><br />
<label>Site</label>
<input type="text" name="site" maxlength="50" /><br />
<input class="botao" type="submit" name="enviar" value="Cadastrar" />
</fieldset>
</form>
</div> <!-- Fim da div#principal -->
</body>
</html>Discussão (4)
Carregando comentários...