Erro ao gravar dados do formulario no mysql
Ola pessoal,
Sou iniciante em PHP. Gostaria de ajuda neste problema.
Estou tentando gravar os dados do formulario.php no banco de dados mysql, mas nao funciona. Ja tentei diversos códigos / scripts e nada funciona. Segue o codigo abaixo para alguem tentar me ajudar:
config.php
_______________
<?php
$host = "localhost"; //Servidor do mysql
$user = "login"; //Usuario do banco de dados
$senha = "senha"; //senha do banco de dados
$db = "sistem"; //banco de dados
$nome_site = "Testando Site"; //Nome do site
$email = "xxx@gmail.com"; //E-mail do administrador
$site = "http://www.dominio.com.br"; //Seu site n se esuqece de bota o http://
mysql_connect($host, $user, $senha) or die (mysql_error());
mysql_select_db($db) or die (mysql_error());
?>
-------------------------------------- fim -----------------------------
cadastro.php (este é para cadastrar os dados do formulario)
<html>
<head>
<title> inserindo</title>
<meta http-equiv="Content-Type" content"text/html; charset=iso-8859-1">
</head>
<body>
<?php
require("config.php")
$nome = $_POST ['nome'];
$documento = $_POST ['documento'];
$sexo = $_POST ['sexo'];
$estado_civil = $_POST ['estado_civil'];
$data_nascimento = $_POST ['data_nascimento'];
$rg = $_POST ['rg'];
$orgao_expedidor= $_POST ['orgao_expedidor'];
$nome_mae = $_POST ['nome_mae'];
$profissao = $_POST ['profissao'];
$fone_residencial = $_POST ['fone_residencial'];
$fone_celular = $_POST ['fone_celular'];
$fone_comercial = $_POST ['fone_comercial'];
$endereco = $_POST ['endereco'];
$numero = $_POST ['numero'];
$complemento = $_POST ['complemento'];
$bairro = $_POST ['bairro'];
$estado = $_POST ['estado'];
$cidade = $_POST ['cidade'];
$cep = $_POST ['cep'];
$ponto_referencia = $_POST ['ponto_referencia'];
$pacotes = $_POST ['pacotes'];
$planos = $_POST ['planos'];
$promo = $_POST ['promo'];
$degust = $_POST ['degust'];
$canais_adicionais = $_POST ['canais_adicionais'];
$ponto_adicional = $_POST ['ponto_adicional'];
$ponto_escravo = $_POST ['ponto_escravo'];
$banco = $_POST ['banco'];
$agencia = $_POST ['agencia'];
$conta_corrente = $_POST ['conta_corrente'];
$data_vencimento = $_POST ['data_vencimento'];
$mes_venda = $_POST ['mes_venda'];
$data_venda = $_POST ['data_venda'];
$nr_proposta = $_POST ['nr_proposta'];
$nr_contrato = $_POST ['nr_contrato'];
$tec_hab = $_POST ['tec_hab'];
$data_agenda = $_POST ['data_agenda'];
$turno_agenda = $_POST ['turno_agenda'];
$instalado = $_POST ['instalado'];
$decoder_hab = $_POST ['decoder_hab'];
$smart_hab = $_POST ['smart_hab'];
$status_venda = $_POST ['status_venda'];
$observacoes = $_POST ['observacoes'];
$sqlinsert = "INSERT INTO clientes (id_cliente,nome,documento,sexo,estado_civil,data_nascimento,rg,orgao_expedidor,nome_mae,profissao,fone_residencial,fone_celular,fone_comercial,email,numero,complemento,bairro,estado,
cidade,cep,ponto_referencia,pacotes,planos,promo,degust,canais_adicionais,ponto_adicional,ponto_escravo,banco,agencia,conta_corrente,data_vencimento,mes_venda,
data_venda,nr_proposta,nr_contrato,tec_hab,data_agenda,turno_agenda,instalado,decoder_hab,smart_hab,status_venda,observacoes) VALUES (null,'$nome','$documento','$sexo','$estado_civil','$data_nascimento','$rg','$orgao_expedidor','$nome_mae','$profissao','$fone_residencial','$fone_celular','$fone_comercial',
'$email','$endereco','$numero','$complemento','$bairro','$estado','$cidade','$cep','$ponto_referencia','$pacote','$plano','$promo','$degust','$canais_adicionais',
'$ponto_adicional','$ponto_escravo','$banco','$agencia','$conta_corrente','$data_vencimento','$mes_venda','$data_venda','$nr_proposta','$nr_contrato','$tec_hab',
'$data_agenda','$turno_agenda','$instalado','$decoder_hab','$smart_hab','$status_venda','$observacoes')";
$inserir=mysql_query($comando_sql,$conexao) or die(mysql_error());
?>
</body>
</html>
------------------- fim -----------------------
formulario de cadastro (cadastro_vendas.php)
<?php
include("config.php");
include("restrito.php");
$sql_busca = "SELECT * FROM user WHERE login = '$login_usuario'";
$exe_busca = mysql_query($sql_busca) or die (mysql_error());
$fet_busca = mysql_fetch_assoc($exe_busca);
$query = mysql_query("SELECT pacote FROM pacote");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ALPHA - Cadastro de Vendas</title>
<script language="JavaScript">
<!--
function mmLoadMenus() {
if (window.mm_menu_1010171106_0) return;
window.mm_menu_1010171106_0 = new Menu("root",169,18,"Verdana, Arial, Helvetica, sans-serif",12,"#FFFFFF","#FFFFFF","#000099","#0066CC","left","middle",3,0,1000,-5,7,true,true,false,0,true,true);
mm_menu_1010171106_0.addMenuItem("Cadastrar Vendas","location='cadastrar_vendas.php'");
mm_menu_1010171106_0.addMenuItem("Consultar Vendas","location='consultar_vendas.php'");
mm_menu_1010171106_0.addMenuItem("Alterar / Excluir Vendas","location='alterar_vendas.php'");
mm_menu_1010171106_0.hideOnMouseOut=true;
mm_menu_1010171106_0.bgColor='#555555';
mm_menu_1010171106_0.menuBorder=1;
mm_menu_1010171106_0.menuLiteBgColor='#FFFFFF';
mm_menu_1010171106_0.menuBorderBgColor='#777777';
window.mm_menu_1010171431_0 = new Menu("root",172,18,"Verdana, Arial, Helvetica, sans-serif",12,"#FFFFFF","#FFFFFF","#000099","#0066CC","left","middle",3,0,1000,-5,7,true,true,false,0,true,true);
mm_menu_1010171431_0.addMenuItem("Cadastar Equipamento","location='cadastro_equipamento.php'");
mm_menu_1010171431_0.addMenuItem("Consultar Estoque","location='consultar_estoque.php'");
mm_menu_1010171431_0.addMenuItem("Alterar / Excluir Estoque","location='alterar_estoque.php'");
mm_menu_1010171431_0.hideOnMouseOut=true;
mm_menu_1010171431_0.bgColor='#555555';
mm_menu_1010171431_0.menuBorder=1;
mm_menu_1010171431_0.menuLiteBgColor='#FFFFFF';
mm_menu_1010171431_0.menuBorderBgColor='#777777';
mm_menu_1010171431_0.writeMenus();
} // mmLoadMenus()
//-->
</script>
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body bgcolor="#C0C1F8" text="#000000" link="#000000" alink="#000000">
<p>
<script language="JavaScript1.2">mmLoadMenus();</script>
</p>
<form name="form1" id="form1" method="post" action="cadastro.php">
<input type="hidden" name="operacao" value="cadastar_venda" />
<script language="JavaScript" type="text/javascript" src="mascara.js"></script>
<table width="1024" border="0" align="center" bgcolor="#FFFFFF" id="container">
<tr>
<td width="197" height="15"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><img src="logo_parceiro.png" width="122" height="75" /></font></td>
<td width="233"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td width="203"><div align="center"></div></td>
<td colspan="2"><p align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="logout.php"></a><img src="logo_embratel.png" width="122" height="75" /></font></p></td>
</tr>
<tr>
<td height="21"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td colspan="2"><div align="right">
<script language="JavaScript1.2" type="text/JavaScript1.2">mmLoadMenus();</script>
</div></td>
</tr>
<tr>
<td height="21" colspan="5"><img src="menu.png" name="image1" width="1024" height="25" border="0" usemap="#MapMap" id="image1" /></td>
</tr>
<tr>
<td height="21"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td rowspan="15"><div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><img src="menu_vert.png" width="150" height="300" border="0" align="top" usemap="#Map2" /></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></div></td>
<td height="21" colspan="4"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Cadastro
de Vendas</font></div></td>
</tr>
<tr>
<td height="21" colspan="4"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td height="21" colspan="4" bgcolor="#B9C0F4"> <div align="center"><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif">Dados
Cliente:</font></div></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nome
do Cliente </font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="nome" id="nome" size="50"/>
<span class="style1"><font color="#FF0000">*</font></span></font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">CPF
/ CNPJ</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="documento" id="documento" />
<span class="style1"><font color="#FF0000">*</font></span> <font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21">
<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Sexo</font></div></td>
<td colspan="3"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="sexo" id="sexo">
<option>Feminino</option>
<option>Masculino</option>
</select>
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><span class="style1"><font color="#FF0000">*</font></span></font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Estado
Civil</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="estado_civil" id="estado_civil">
<option>Casado(a)</option>
<option>Solteiro(a)</option>
<option>Separado(a)</option>
<option>Viuvo(a)</option>
</select>
</font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Data
Nascimento</font></div></td>
<td colspan="3"><input type="text" name="data_nascimento" id="data_nascimento" onKeyPress="MascaraData(form1.data);"
maxlength="10" onBlur= "ValidaDataform1.data);"> <font color="#FF0000"><span class="style1">*</span></font>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font> </tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">RG </font></div></td>
<td colspan="3"><input type="text" name="rg" id="rg" /> <span class="style1"><font color="#FF0000">*</font>
</span><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Orgão
Expedidor</font></div></td>
<td colspan="3"><input type="text" name="orgao_expedidor" id="orgao_expedidor" />
<span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nome
da Mãe</font></div></td>
<td colspan="3"><input type="text" name="nome_mae" id="nome_mae" size="50"/>
<span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Profissão</font></div></td>
<td colspan="3"><input type="text" name="profissao" id="profissao" size"50" />
<span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Fone
Residencial</font></div></td>
<td colspan="3"><input type="text" name="fone_residencial" id="fone_residencial" onKeyPress="MascaraTelefone(form1.tel);"
maxlength="14" onBlur="ValidaTelefone(form1.tel);"> <span class="style1"><font color="#FF0000">*</font></span>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Fone
Celular</font></div></td>
<td colspan="3"><input type="text" name="fone_celular" id="fone_celular" onkeypress="MascaraTelefone(form1.tel);"
maxlength="14" onblur="ValidaTelefone(form1.tel);" /> <span class="style1"><font color="#FF0000">*</font></span>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21"> <div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Fone
Comercial </font></div></td>
<td colspan="3"><input type="text" name="fone_comercial" id="fone_comercial" onkeypress="MascaraTelefone(form1.tel);"
maxlength="14" onblur="ValidaTelefone(form1.tel);" /> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="email" id="email" size="50"/>
</font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td height="21"> </td>
<td colspan="4" bgcolor="#B9C0F4"> <div align="center"><font color="#000066"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Endereço
de Instalação:</font></font><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></div></td>
</tr>
<tr>
<td height="21"> </td>
<td> <div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Endereço</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="endereco" id="endereco" size="50"/>
<span class="style1"><font color="#FF0000">*</font></span> </font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Numero</font></div></td>
<td><input type="text" name="numero" id="numero" /> <span class="style1"><font color="#FF0000">*</font></span></td>
<td width="118"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Complemento</font></div></td>
<td width="255"><input type="text" name="complemento" id="complemento" size="35" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Bairro</font></div></td>
<td><input type="text" name="bairro" id="bairro" /> <span class="style1"><font color="#FF0000">*</font></span></td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Estado</font></div></td>
<td><select name="estados" id="estados" class="textBox">
<option>AC - Acre</option>
<option>AL - Alagoas</option>
<option>AP - Amapá</option>
<option>AM - Amazonas</option>
<option>BA - Bahia</option>
<option>CE - Ceará</option>
<option>DF - Distrito Federal</option>
<option>ES - Espirito Santo</option>
<option>GO - Goias</option>
<option>MA - Maranhão</option>
<option>MT - Mato Grosso</option>
<option>MS - Mato Grosso do Sul</option>
<option>MG - Minas Gerais</option>
<option>PA - Pará</option>
<option>PB - Paraíba</option>
<option>PR - Paraná</option>
<option>PE - Pernambuco</option>
<option>PI - Piauí</option>
<option>RN - Rio Grande do Norte</option>
<option>RS - Rio Grande do Sul</option>
<option>RJ - Rio de Janeiro</option>
<option>RO - Rondônia</option>
<option>RR - Roraima</option>
<option>SC - Santa Catarina</option>
<option>SP - São Paulo</option>
<option>SE - Sergipe</option>
<option>TO - Tocantins</option>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Cidade</font></div></td>
<td><input type="text" name="cidade" id="cidade" /></td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">CEP</font></div></td>
<td><input type="text" name="cep" id="cep" onKeyPress="MascaraCep(form1.cep);"
maxlength="10" onBlur="ValidaCep(form1.cep)"> <font color="#FF0000"><span class="style1">*</span></font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Ponto
de Referência</font></div></td>
<td colspan="3"><input type="text" name="ponto_referencia" id="ponto_referencia" size="50" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td height="21"> </td>
<td colspan="4" bgcolor="#B9C0F4"> <div align="center"><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif">Dados
do Produto Contratado</font></div></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Pacote
Contratado </font></div></td>
<td colspan="3"><select name="pacotes" id="pacotes">
<?php while($prod = mysql_fetch_array($query)) { ?>
<option value="<?php echo $prod['pacote'] ?>"><?php echo $prod['pacote'] ?></option>
<?php } ?>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Plano
Contratado </font></div></td>
<td colspan="3"><select name="planos" id="planos">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Promoção</font></div></td>
<td colspan="3"><select name="promo" id="promo">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Degustação</font></div></td>
<td colspan="3"><select name="degust" id="degust">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Canais
Adicionais </font></div></td>
<td colspan="3"><select name="canais_adicionais" id="canais_adicionais">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Cliente
deseja Ponto Adicional?</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="ponto_adicional" id="ponto_adicional">
<option>Selecione</option>
<option>SIM</option>
<option>NÃO</option>
</select>
</font></td>
</tr>
<tr>
<td height="27"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Cliente
deseja Ponto Escravo?</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="ponto_escravo" id="ponto_escravo">
<option>Selecione</option>
<option>SIM</option>
<option>NÃO</option>
</select>
</font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td height="21"> </td>
<td colspan="4" bgcolor="#B9C0F4"> <div align="center"><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif">Dados
Bancários</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></div></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Forma
de Pagamento</font></div></td>
<td colspan="3"><select name="forma_pagamento" id="forma_pagamento">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Banco</font></div></td>
<td colspan="3"><select name="banco" id="banco"\>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Agência</font></div></td>
<td colspan="3"><input type="text" name="agencia" id="agencia" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Conta
Corrente</font></font></div></td>
<td colspan="3"><input type="text" name="conta_corrente" id="conta_corrente" /></td>
</tr>
<tr>
<td height="27"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Data
Vencimento </font></font></div></td>
<td colspan="3"><select name="data_vencimento" id="data_vencimento">
<option>1</option>
<option>4</option>
<option>6</option>
<option>8</option>
<option>10</option>
<option>12</option>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Mês
da Venda</font></div></td>
<td colspan="3"><select name="mes_venda" id="mes_venda">
<option>Selecione</option>
<option>JANEIRO</option>
<option>FEVEREIRO</option>
<option>MARÇO</option>
<option>ABRIL</option>
<option>MAIO</option>
<option>JUNHO</option>
<option>JULHO</option>
<option>AGOSTO</option>
<option>SETEMBRO</option>
<option>OUTUBRO</option>
<option>NOVEMBRO</option>
<option>DEZEMBRO</option>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Data
da Venda</font></font></div></td>
<td colspan="3"><input type="text" name="data_venda" id="data_venda" onKeyPress="MascaraData(form1.data);"
maxlength="10" onBlur= "ValidaDataform1.data);"> <span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Vendedor</font></div></td>
<td colspan="3"><select name="funcionarios" id="funcionarios">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"></font></font></div></td>
<td colspan="3"> </td>
</tr>
<tr>
<td height="21"> </td>
<td colspan="4" bgcolor="#B9C0F4"> <div align="center"><font size="2"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif">Dados
da Instalação</font></font></div></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nº
Proposta </font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="nr_proposta" id="nr_proposta" />
</font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nº
Contrato </font></div></td>
<td colspan="3"><input type="text" name="nr_contrato" id="nr_contrato" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Técnico</font></font></font></font></font></div></td>
<td colspan="3"><select name="tec_hab" id="tec_hab">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Data
Agenda </font></font></font></font></font></div></td>
<td><input type="text" name="data_agenda" id="data_agenda" onKeyPress="MascaraData(form1.data);"
maxlength="10" onBlur= "ValidaDataform1.data);"></td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Turno</font></div></td>
<td><select name="turno_agenda" id="turno_agenda">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Instalado
por </font></font></font></font></font></div></td>
<td colspan="3"><select name="instalado" id="instalado">
<option>Selecione</option>
<option>MASTER</option>
<option>PRÓPRIA</option>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Decoder</font></font></font></font></font></div></td>
<td><input type="text" name="decoder_hab" id="decoder_hab" /></td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Smart
Card </font></div></td>
<td><input type="text" name="smart_hab" id="smart_hab" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Status
da Instalação</font></font></font></font></font></div></td>
<td colspan="3"><select name="status_venda" id="status_venda">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Observações</font></font></font></font></font></div></td>
<td colspan="3"><textarea name="observacoes" id="observacoes" cols="70"></textarea></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif"></font></font></font></font></font></div></td>
<td colspan="3"> </td>
</tr>
<tr>
<td height="21"> </td>
<td> </td>
<td colspan="3"><label>
<input type="submit" name="Submit" value="Cadastrar Venda"/>
</label> <font color="#FF0000" size="1" face="Verdana, Arial, Helvetica, sans-serif">*
Cadastro Obrigatório</font> </td>
</tr>
</table>
<map name="MapMap" id="Map2">
<area shape="rect" coords="98,1,179,24" href="#" onmouseover="MM_showMenu(window.mm_menu_1010171106_0,98,24,null,'image1')" onmouseout="MM_startTimeout();" />
<area shape="rect" coords="302,-1,373,24" href="#" onmouseover="MM_showMenu(window.mm_menu_1010171431_0,303,25,null,'image1')" onmouseout="MM_startTimeout();" />
<area shape="rect" coords="476,1,573,24" href="manutencao.php" />
<area shape="rect" coords="704,1,773,25" href="relatorios.php" />
<area shape="rect" coords="899,0,943,25" href="logout.php" />
</map>
</form>
<p> </p>
<p></p>
<p> </p>
<a href="logout.php"> </a>
<map name="Map" id="Map">
<area shape="rect" coords="98,1,179,24" href="#" onmouseover="MM_showMenu(window.mm_menu_1010171106_0,98,24,null,'image1')" onmouseout="MM_startTimeout();" />
<area shape="rect" coords="302,0,373,25" href="#" onmouseover="MM_showMenu(window.mm_menu_1010171431_0,303,25,null,'image1')" onmouseout="MM_startTimeout();" />
<area shape="rect" coords="476,1,573,24" href="manutencao.php" />
<area shape="rect" coords="704,1,773,25" href="relatorios.php" />
<area shape="rect" coords="899,0,943,25" href="logout.php" />
</map>
<map name="Map2" id="Map2">
<area shape="rect" coords="4,45,146,64" href="cadastrar_vendas.php" />
<area shape="rect" coords="2,79,147,99" href="consultar_vendas.php" />
<area shape="rect" coords="2,112,147,133" href="alterar_vendas.php" />
</map>
</body>
</html>
-------------- fim ---------------------
Alguem pode me dizer onde esta o erro?
Obrigado
Sou iniciante em PHP. Gostaria de ajuda neste problema.
Estou tentando gravar os dados do formulario.php no banco de dados mysql, mas nao funciona. Ja tentei diversos códigos / scripts e nada funciona. Segue o codigo abaixo para alguem tentar me ajudar:
config.php
_______________
<?php
$host = "localhost"; //Servidor do mysql
$user = "login"; //Usuario do banco de dados
$senha = "senha"; //senha do banco de dados
$db = "sistem"; //banco de dados
$nome_site = "Testando Site"; //Nome do site
$email = "xxx@gmail.com"; //E-mail do administrador
$site = "http://www.dominio.com.br"; //Seu site n se esuqece de bota o http://
mysql_connect($host, $user, $senha) or die (mysql_error());
mysql_select_db($db) or die (mysql_error());
?>
-------------------------------------- fim -----------------------------
cadastro.php (este é para cadastrar os dados do formulario)
<html>
<head>
<title> inserindo</title>
<meta http-equiv="Content-Type" content"text/html; charset=iso-8859-1">
</head>
<body>
<?php
require("config.php")
$nome = $_POST ['nome'];
$documento = $_POST ['documento'];
$sexo = $_POST ['sexo'];
$estado_civil = $_POST ['estado_civil'];
$data_nascimento = $_POST ['data_nascimento'];
$rg = $_POST ['rg'];
$orgao_expedidor= $_POST ['orgao_expedidor'];
$nome_mae = $_POST ['nome_mae'];
$profissao = $_POST ['profissao'];
$fone_residencial = $_POST ['fone_residencial'];
$fone_celular = $_POST ['fone_celular'];
$fone_comercial = $_POST ['fone_comercial'];
$endereco = $_POST ['endereco'];
$numero = $_POST ['numero'];
$complemento = $_POST ['complemento'];
$bairro = $_POST ['bairro'];
$estado = $_POST ['estado'];
$cidade = $_POST ['cidade'];
$cep = $_POST ['cep'];
$ponto_referencia = $_POST ['ponto_referencia'];
$pacotes = $_POST ['pacotes'];
$planos = $_POST ['planos'];
$promo = $_POST ['promo'];
$degust = $_POST ['degust'];
$canais_adicionais = $_POST ['canais_adicionais'];
$ponto_adicional = $_POST ['ponto_adicional'];
$ponto_escravo = $_POST ['ponto_escravo'];
$banco = $_POST ['banco'];
$agencia = $_POST ['agencia'];
$conta_corrente = $_POST ['conta_corrente'];
$data_vencimento = $_POST ['data_vencimento'];
$mes_venda = $_POST ['mes_venda'];
$data_venda = $_POST ['data_venda'];
$nr_proposta = $_POST ['nr_proposta'];
$nr_contrato = $_POST ['nr_contrato'];
$tec_hab = $_POST ['tec_hab'];
$data_agenda = $_POST ['data_agenda'];
$turno_agenda = $_POST ['turno_agenda'];
$instalado = $_POST ['instalado'];
$decoder_hab = $_POST ['decoder_hab'];
$smart_hab = $_POST ['smart_hab'];
$status_venda = $_POST ['status_venda'];
$observacoes = $_POST ['observacoes'];
$sqlinsert = "INSERT INTO clientes (id_cliente,nome,documento,sexo,estado_civil,data_nascimento,rg,orgao_expedidor,nome_mae,profissao,fone_residencial,fone_celular,fone_comercial,email,numero,complemento,bairro,estado,
cidade,cep,ponto_referencia,pacotes,planos,promo,degust,canais_adicionais,ponto_adicional,ponto_escravo,banco,agencia,conta_corrente,data_vencimento,mes_venda,
data_venda,nr_proposta,nr_contrato,tec_hab,data_agenda,turno_agenda,instalado,decoder_hab,smart_hab,status_venda,observacoes) VALUES (null,'$nome','$documento','$sexo','$estado_civil','$data_nascimento','$rg','$orgao_expedidor','$nome_mae','$profissao','$fone_residencial','$fone_celular','$fone_comercial',
'$email','$endereco','$numero','$complemento','$bairro','$estado','$cidade','$cep','$ponto_referencia','$pacote','$plano','$promo','$degust','$canais_adicionais',
'$ponto_adicional','$ponto_escravo','$banco','$agencia','$conta_corrente','$data_vencimento','$mes_venda','$data_venda','$nr_proposta','$nr_contrato','$tec_hab',
'$data_agenda','$turno_agenda','$instalado','$decoder_hab','$smart_hab','$status_venda','$observacoes')";
$inserir=mysql_query($comando_sql,$conexao) or die(mysql_error());
?>
</body>
</html>
------------------- fim -----------------------
formulario de cadastro (cadastro_vendas.php)
<?php
include("config.php");
include("restrito.php");
$sql_busca = "SELECT * FROM user WHERE login = '$login_usuario'";
$exe_busca = mysql_query($sql_busca) or die (mysql_error());
$fet_busca = mysql_fetch_assoc($exe_busca);
$query = mysql_query("SELECT pacote FROM pacote");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ALPHA - Cadastro de Vendas</title>
<script language="JavaScript">
<!--
function mmLoadMenus() {
if (window.mm_menu_1010171106_0) return;
window.mm_menu_1010171106_0 = new Menu("root",169,18,"Verdana, Arial, Helvetica, sans-serif",12,"#FFFFFF","#FFFFFF","#000099","#0066CC","left","middle",3,0,1000,-5,7,true,true,false,0,true,true);
mm_menu_1010171106_0.addMenuItem("Cadastrar Vendas","location='cadastrar_vendas.php'");
mm_menu_1010171106_0.addMenuItem("Consultar Vendas","location='consultar_vendas.php'");
mm_menu_1010171106_0.addMenuItem("Alterar / Excluir Vendas","location='alterar_vendas.php'");
mm_menu_1010171106_0.hideOnMouseOut=true;
mm_menu_1010171106_0.bgColor='#555555';
mm_menu_1010171106_0.menuBorder=1;
mm_menu_1010171106_0.menuLiteBgColor='#FFFFFF';
mm_menu_1010171106_0.menuBorderBgColor='#777777';
window.mm_menu_1010171431_0 = new Menu("root",172,18,"Verdana, Arial, Helvetica, sans-serif",12,"#FFFFFF","#FFFFFF","#000099","#0066CC","left","middle",3,0,1000,-5,7,true,true,false,0,true,true);
mm_menu_1010171431_0.addMenuItem("Cadastar Equipamento","location='cadastro_equipamento.php'");
mm_menu_1010171431_0.addMenuItem("Consultar Estoque","location='consultar_estoque.php'");
mm_menu_1010171431_0.addMenuItem("Alterar / Excluir Estoque","location='alterar_estoque.php'");
mm_menu_1010171431_0.hideOnMouseOut=true;
mm_menu_1010171431_0.bgColor='#555555';
mm_menu_1010171431_0.menuBorder=1;
mm_menu_1010171431_0.menuLiteBgColor='#FFFFFF';
mm_menu_1010171431_0.menuBorderBgColor='#777777';
mm_menu_1010171431_0.writeMenus();
} // mmLoadMenus()
//-->
</script>
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body bgcolor="#C0C1F8" text="#000000" link="#000000" alink="#000000">
<p>
<script language="JavaScript1.2">mmLoadMenus();</script>
</p>
<form name="form1" id="form1" method="post" action="cadastro.php">
<input type="hidden" name="operacao" value="cadastar_venda" />
<script language="JavaScript" type="text/javascript" src="mascara.js"></script>
<table width="1024" border="0" align="center" bgcolor="#FFFFFF" id="container">
<tr>
<td width="197" height="15"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><img src="logo_parceiro.png" width="122" height="75" /></font></td>
<td width="233"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td width="203"><div align="center"></div></td>
<td colspan="2"><p align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="logout.php"></a><img src="logo_embratel.png" width="122" height="75" /></font></p></td>
</tr>
<tr>
<td height="21"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td colspan="2"><div align="right">
<script language="JavaScript1.2" type="text/JavaScript1.2">mmLoadMenus();</script>
</div></td>
</tr>
<tr>
<td height="21" colspan="5"><img src="menu.png" name="image1" width="1024" height="25" border="0" usemap="#MapMap" id="image1" /></td>
</tr>
<tr>
<td height="21"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td rowspan="15"><div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><img src="menu_vert.png" width="150" height="300" border="0" align="top" usemap="#Map2" /></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></div></td>
<td height="21" colspan="4"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Cadastro
de Vendas</font></div></td>
</tr>
<tr>
<td height="21" colspan="4"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td height="21" colspan="4" bgcolor="#B9C0F4"> <div align="center"><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif">Dados
Cliente:</font></div></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nome
do Cliente </font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="nome" id="nome" size="50"/>
<span class="style1"><font color="#FF0000">*</font></span></font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">CPF
/ CNPJ</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="documento" id="documento" />
<span class="style1"><font color="#FF0000">*</font></span> <font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21">
<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Sexo</font></div></td>
<td colspan="3"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="sexo" id="sexo">
<option>Feminino</option>
<option>Masculino</option>
</select>
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><span class="style1"><font color="#FF0000">*</font></span></font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Estado
Civil</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="estado_civil" id="estado_civil">
<option>Casado(a)</option>
<option>Solteiro(a)</option>
<option>Separado(a)</option>
<option>Viuvo(a)</option>
</select>
</font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Data
Nascimento</font></div></td>
<td colspan="3"><input type="text" name="data_nascimento" id="data_nascimento" onKeyPress="MascaraData(form1.data);"
maxlength="10" onBlur= "ValidaDataform1.data);"> <font color="#FF0000"><span class="style1">*</span></font>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font> </tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">RG </font></div></td>
<td colspan="3"><input type="text" name="rg" id="rg" /> <span class="style1"><font color="#FF0000">*</font>
</span><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Orgão
Expedidor</font></div></td>
<td colspan="3"><input type="text" name="orgao_expedidor" id="orgao_expedidor" />
<span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nome
da Mãe</font></div></td>
<td colspan="3"><input type="text" name="nome_mae" id="nome_mae" size="50"/>
<span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Profissão</font></div></td>
<td colspan="3"><input type="text" name="profissao" id="profissao" size"50" />
<span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Fone
Residencial</font></div></td>
<td colspan="3"><input type="text" name="fone_residencial" id="fone_residencial" onKeyPress="MascaraTelefone(form1.tel);"
maxlength="14" onBlur="ValidaTelefone(form1.tel);"> <span class="style1"><font color="#FF0000">*</font></span>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Fone
Celular</font></div></td>
<td colspan="3"><input type="text" name="fone_celular" id="fone_celular" onkeypress="MascaraTelefone(form1.tel);"
maxlength="14" onblur="ValidaTelefone(form1.tel);" /> <span class="style1"><font color="#FF0000">*</font></span>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21"> <div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Fone
Comercial </font></div></td>
<td colspan="3"><input type="text" name="fone_comercial" id="fone_comercial" onkeypress="MascaraTelefone(form1.tel);"
maxlength="14" onblur="ValidaTelefone(form1.tel);" /> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#333333" size="1">*Somente
Números (sem traços, barras ou pontos)</font></font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="email" id="email" size="50"/>
</font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td height="21"> </td>
<td colspan="4" bgcolor="#B9C0F4"> <div align="center"><font color="#000066"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Endereço
de Instalação:</font></font><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></div></td>
</tr>
<tr>
<td height="21"> </td>
<td> <div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Endereço</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="endereco" id="endereco" size="50"/>
<span class="style1"><font color="#FF0000">*</font></span> </font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Numero</font></div></td>
<td><input type="text" name="numero" id="numero" /> <span class="style1"><font color="#FF0000">*</font></span></td>
<td width="118"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Complemento</font></div></td>
<td width="255"><input type="text" name="complemento" id="complemento" size="35" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Bairro</font></div></td>
<td><input type="text" name="bairro" id="bairro" /> <span class="style1"><font color="#FF0000">*</font></span></td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Estado</font></div></td>
<td><select name="estados" id="estados" class="textBox">
<option>AC - Acre</option>
<option>AL - Alagoas</option>
<option>AP - Amapá</option>
<option>AM - Amazonas</option>
<option>BA - Bahia</option>
<option>CE - Ceará</option>
<option>DF - Distrito Federal</option>
<option>ES - Espirito Santo</option>
<option>GO - Goias</option>
<option>MA - Maranhão</option>
<option>MT - Mato Grosso</option>
<option>MS - Mato Grosso do Sul</option>
<option>MG - Minas Gerais</option>
<option>PA - Pará</option>
<option>PB - Paraíba</option>
<option>PR - Paraná</option>
<option>PE - Pernambuco</option>
<option>PI - Piauí</option>
<option>RN - Rio Grande do Norte</option>
<option>RS - Rio Grande do Sul</option>
<option>RJ - Rio de Janeiro</option>
<option>RO - Rondônia</option>
<option>RR - Roraima</option>
<option>SC - Santa Catarina</option>
<option>SP - São Paulo</option>
<option>SE - Sergipe</option>
<option>TO - Tocantins</option>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Cidade</font></div></td>
<td><input type="text" name="cidade" id="cidade" /></td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">CEP</font></div></td>
<td><input type="text" name="cep" id="cep" onKeyPress="MascaraCep(form1.cep);"
maxlength="10" onBlur="ValidaCep(form1.cep)"> <font color="#FF0000"><span class="style1">*</span></font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Ponto
de Referência</font></div></td>
<td colspan="3"><input type="text" name="ponto_referencia" id="ponto_referencia" size="50" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td height="21"> </td>
<td colspan="4" bgcolor="#B9C0F4"> <div align="center"><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif">Dados
do Produto Contratado</font></div></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Pacote
Contratado </font></div></td>
<td colspan="3"><select name="pacotes" id="pacotes">
<?php while($prod = mysql_fetch_array($query)) { ?>
<option value="<?php echo $prod['pacote'] ?>"><?php echo $prod['pacote'] ?></option>
<?php } ?>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Plano
Contratado </font></div></td>
<td colspan="3"><select name="planos" id="planos">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Promoção</font></div></td>
<td colspan="3"><select name="promo" id="promo">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Degustação</font></div></td>
<td colspan="3"><select name="degust" id="degust">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Canais
Adicionais </font></div></td>
<td colspan="3"><select name="canais_adicionais" id="canais_adicionais">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Cliente
deseja Ponto Adicional?</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="ponto_adicional" id="ponto_adicional">
<option>Selecione</option>
<option>SIM</option>
<option>NÃO</option>
</select>
</font></td>
</tr>
<tr>
<td height="27"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Cliente
deseja Ponto Escravo?</font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="ponto_escravo" id="ponto_escravo">
<option>Selecione</option>
<option>SIM</option>
<option>NÃO</option>
</select>
</font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
</tr>
<tr>
<td height="21"> </td>
<td colspan="4" bgcolor="#B9C0F4"> <div align="center"><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif">Dados
Bancários</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></div></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Forma
de Pagamento</font></div></td>
<td colspan="3"><select name="forma_pagamento" id="forma_pagamento">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Banco</font></div></td>
<td colspan="3"><select name="banco" id="banco"\>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Agência</font></div></td>
<td colspan="3"><input type="text" name="agencia" id="agencia" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Conta
Corrente</font></font></div></td>
<td colspan="3"><input type="text" name="conta_corrente" id="conta_corrente" /></td>
</tr>
<tr>
<td height="27"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Data
Vencimento </font></font></div></td>
<td colspan="3"><select name="data_vencimento" id="data_vencimento">
<option>1</option>
<option>4</option>
<option>6</option>
<option>8</option>
<option>10</option>
<option>12</option>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Mês
da Venda</font></div></td>
<td colspan="3"><select name="mes_venda" id="mes_venda">
<option>Selecione</option>
<option>JANEIRO</option>
<option>FEVEREIRO</option>
<option>MARÇO</option>
<option>ABRIL</option>
<option>MAIO</option>
<option>JUNHO</option>
<option>JULHO</option>
<option>AGOSTO</option>
<option>SETEMBRO</option>
<option>OUTUBRO</option>
<option>NOVEMBRO</option>
<option>DEZEMBRO</option>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Data
da Venda</font></font></div></td>
<td colspan="3"><input type="text" name="data_venda" id="data_venda" onKeyPress="MascaraData(form1.data);"
maxlength="10" onBlur= "ValidaDataform1.data);"> <span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Vendedor</font></div></td>
<td colspan="3"><select name="funcionarios" id="funcionarios">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"></font></font></div></td>
<td colspan="3"> </td>
</tr>
<tr>
<td height="21"> </td>
<td colspan="4" bgcolor="#B9C0F4"> <div align="center"><font size="2"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif">Dados
da Instalação</font></font></div></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nº
Proposta </font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="nr_proposta" id="nr_proposta" />
</font></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nº
Contrato </font></div></td>
<td colspan="3"><input type="text" name="nr_contrato" id="nr_contrato" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Técnico</font></font></font></font></font></div></td>
<td colspan="3"><select name="tec_hab" id="tec_hab">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Data
Agenda </font></font></font></font></font></div></td>
<td><input type="text" name="data_agenda" id="data_agenda" onKeyPress="MascaraData(form1.data);"
maxlength="10" onBlur= "ValidaDataform1.data);"></td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Turno</font></div></td>
<td><select name="turno_agenda" id="turno_agenda">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Instalado
por </font></font></font></font></font></div></td>
<td colspan="3"><select name="instalado" id="instalado">
<option>Selecione</option>
<option>MASTER</option>
<option>PRÓPRIA</option>
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Decoder</font></font></font></font></font></div></td>
<td><input type="text" name="decoder_hab" id="decoder_hab" /></td>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Smart
Card </font></div></td>
<td><input type="text" name="smart_hab" id="smart_hab" /></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Status
da Instalação</font></font></font></font></font></div></td>
<td colspan="3"><select name="status_venda" id="status_venda">
</select></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif">Observações</font></font></font></font></font></div></td>
<td colspan="3"><textarea name="observacoes" id="observacoes" cols="70"></textarea></td>
</tr>
<tr>
<td height="21"> </td>
<td><div align="right"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font face="Georgia, Times New Roman, Times, serif"><font face="Verdana, Arial, Helvetica, sans-serif"></font></font></font></font></font></div></td>
<td colspan="3"> </td>
</tr>
<tr>
<td height="21"> </td>
<td> </td>
<td colspan="3"><label>
<input type="submit" name="Submit" value="Cadastrar Venda"/>
</label> <font color="#FF0000" size="1" face="Verdana, Arial, Helvetica, sans-serif">*
Cadastro Obrigatório</font> </td>
</tr>
</table>
<map name="MapMap" id="Map2">
<area shape="rect" coords="98,1,179,24" href="#" onmouseover="MM_showMenu(window.mm_menu_1010171106_0,98,24,null,'image1')" onmouseout="MM_startTimeout();" />
<area shape="rect" coords="302,-1,373,24" href="#" onmouseover="MM_showMenu(window.mm_menu_1010171431_0,303,25,null,'image1')" onmouseout="MM_startTimeout();" />
<area shape="rect" coords="476,1,573,24" href="manutencao.php" />
<area shape="rect" coords="704,1,773,25" href="relatorios.php" />
<area shape="rect" coords="899,0,943,25" href="logout.php" />
</map>
</form>
<p> </p>
<p></p>
<p> </p>
<a href="logout.php"> </a>
<map name="Map" id="Map">
<area shape="rect" coords="98,1,179,24" href="#" onmouseover="MM_showMenu(window.mm_menu_1010171106_0,98,24,null,'image1')" onmouseout="MM_startTimeout();" />
<area shape="rect" coords="302,0,373,25" href="#" onmouseover="MM_showMenu(window.mm_menu_1010171431_0,303,25,null,'image1')" onmouseout="MM_startTimeout();" />
<area shape="rect" coords="476,1,573,24" href="manutencao.php" />
<area shape="rect" coords="704,1,773,25" href="relatorios.php" />
<area shape="rect" coords="899,0,943,25" href="logout.php" />
</map>
<map name="Map2" id="Map2">
<area shape="rect" coords="4,45,146,64" href="cadastrar_vendas.php" />
<area shape="rect" coords="2,79,147,99" href="consultar_vendas.php" />
<area shape="rect" coords="2,112,147,133" href="alterar_vendas.php" />
</map>
</body>
</html>
-------------- fim ---------------------
Alguem pode me dizer onde esta o erro?
Obrigado
comentários (0)
suspender
Lista de Respostas:
17/10/2011 3:54pm
(~13 anos atrás)
(~13 anos atrás)
Eita, é código demais para olharmos num simples forum!
Dê umas dicas, pelo menos: que tipo de erro está dando? Aparece algum erro na tela?
Dê umas dicas, pelo menos: que tipo de erro está dando? Aparece algum erro na tela?
18/10/2011 1:37am
(~13 anos atrás)
(~13 anos atrás)
na verdade ja tentei todos os codigos q achei na web mas nada funciona.
preciso q os dados que coloco no form, seja gravado no mysql. No arquivo PHP aparece q os dados foram salvos, mas no BD nao aparece o registro.
O que pode ser?
preciso q os dados que coloco no form, seja gravado no mysql. No arquivo PHP aparece q os dados foram salvos, mas no BD nao aparece o registro.
O que pode ser?
18/10/2011 4:24am
(~13 anos atrás)
(~13 anos atrás)
Bom, numa olhada rápida, isto aqui parece estar errado. Veja se resolve:
No cadastro.php:
Ao invés de $inserir=mysql_query($comando_sql,$conexao) or die(mysql_error());
Faça $inserir=mysql_query($sqlinsert,$conexao) or die(mysql_error());
Ou só $inserir=mysql_query($sqlinsert) or die(mysql_error()); já que parece que a conexão já estará feita pelo config.php .
E, como vc já deve saber, PHP e banco de dados não são tão fáceis quanto HMTL. Tem que estudar um pouco para que a coisa não fique uma tortura sem fim.
No cadastro.php:
Ao invés de $inserir=mysql_query($comando_sql,$conexao) or die(mysql_error());
Faça $inserir=mysql_query($sqlinsert,$conexao) or die(mysql_error());
Ou só $inserir=mysql_query($sqlinsert) or die(mysql_error()); já que parece que a conexão já estará feita pelo config.php .
E, como vc já deve saber, PHP e banco de dados não são tão fáceis quanto HMTL. Tem que estudar um pouco para que a coisa não fique uma tortura sem fim.