Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá a todos, ontem eu postei um topico aqui pergunta sobre sistema de login e tals, mesmo com a ajuda do pessoal nao consegui fazer funcionar direito.bom tive uma outra ideia que acho que fica mais facilno meu site tem os arquivos, formulario de Compra.php, enviar_compra.php, cadastro.php e etco que quero é o seguinteno formulario de compra tem os seguintes campos: nome de usuario, senha, tipo de compra, frete e talso que eu quero é que quando a pessoa for comprar, ela inseri o usuario e senha e preencha todos os campos, o enviar_compra.php verificar se existe o usuario e senha no banco de dados, se der erro e o usuario e senha forem errados, quero que ele nao insira no banco de dados os outros campo do formulario como produto que querr etc, mas se o usuario for certo ele inseri os valores no banco de dados e avisa que foi enviado o formulario com sucesso.nao sei se entederam muito bem, creio que deva ser parecido com um sistema de login, só que eu quero sq se o login for certo o arquivo enviar_compra.php inseri os valores dos campos no banco de dados, mas se nao for ele nao insere e da erro.segue abaixo meus arquivosObrigadoenviar_compra.php
> <?include "config.php";$db = mysql_connect ($host, $login_db, $senha_db);$basedados = mysql_select_db($database);$cadastrar = mysql_query("INSERT INTO comprar (usuario, senha, pagamento, banco, frete, produto1, produto2, produto3, produto4)VALUES ('$usuario','$email','$pagamento','$banco','$frete','$produto1','$produto2','$produto3','$produto4')", $db);?></font></div></body></html>
Formulario De Compra.php
> <html><head><title>Documento sem título</title><style type="text/css">@import url("../conteudo.css");</style></head><body><div align="center"><form action="enviar_compra.php" target="_blank" method="post" enctype="multipart/form-data" name="cadastro" id="cadastro" onSubmit="return valida();" ><table width="522" border="0" align="center" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <><tr><td height="24" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="378" height="24" valign="top" background="../layout/categorias/formulario_compra.jpg"><!--DWLayoutEmptyCell--> </td> </tr></table></td><td width="93"> </td><td width="35"> </td><td width="16"> </td></tr><tr> <td width="10" height="18"></td> <td width="368"></td> <td></td> <td></td> <td></td></tr><tr> <td height="61"></td> <td colspan="3" valign="top"><table width="100%" border="0" style="border:1px solid #4d6c98" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="494" height="57" valign="top"><span class="form_font form01">Bem vindo ao Formulario De Compra Keishop.<br> Preencha todos os dados do formulario corretamente, com seu nome de usuario do site e email.<br> Dúvidas sobre o processo de compra? Clique Aqui e veja detalhadamente como Comprar.</span></td> </tr> <tr> <td height="2"></td> </tr> </table></td> <td> </td></tr><tr> <td height="39"></td> <td> </td> <td></td> <td></td> <td></td></tr><tr> <td height="397"></td> <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="../layout/bgcadastro.jpg" style="border:1px solid #4d6c98"> <!--DWLayoutTable--> <tr> <td width="12" height="10"></td> <td width="57"></td> <td width="23"></td> <td width="29"></td> <td width="12"></td> <td width="12"></td> <td width="49"></td> <td width="26"></td> <td width="72"></td> <td width="6"></td> <td width="23"></td> <td width="17"></td> <td width="4"></td> <td width="5"></td> <td width="13"></td> <td width="99"></td> </tr> <tr> <td height="20"> </td> <td colspan="3" valign="top"><span class="form_font form01">Nome De Usuario:</span></td> <td colspan="6" rowspan="2" valign="top"><label for="nome"></label> <input name="usuario" type="text" id="usuario" width="160px" height="16px" style="border:1px solid #4d6c98"></td> <td> </td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="1"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="11"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="1"></td> <td rowspan="2" valign="top"><span class="form_font form01">Senha:</span></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="21"></td> <td></td> <td></td> <td colspan="11" valign="top"><input name="senha" type="password" id="senha" style="border:1px solid #4d6c98" size="30" height="16px"></td> <td> </td> </tr> <tr> <td height="11"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="1"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td colspan="6" rowspan="2" valign="top"><input name="deposito_em_conta" type="radio" id="pagamento" value="pagamento" checked> <span class="style1"> <label for="pagamento"><span class="form_font form01">Deposito Em Conta</span></label> <span class="form_font form01"> Poupança </span></span> <label for="pagamento"></label></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="20"></td> <td colspan="4" valign="top"><span class="form_font form01">Forma De Pagamento:</span></td> <td></td> <td> </td> <td></td> <td></td> <td></td> </tr> <tr> <td height="12"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="22"></td> <td colspan="4" valign="top"><span class="form_font form01">Selecione o Banco:</span></td> <td> </td> <td colspan="7" valign="top"><label for="banco"></label> <select name="banco" class="form_font form_cor6" id="banco" style="border:1px solid #4d6c98" height="16px"> <option selected>Caixa Economica Federal</option> <option>Bradesco</option> </select> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td height="11"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="19"></td> <td colspan="3" valign="top"><span class="form_font form01">Método De Envio:</span></td> <td></td> <td></td> <td colspan="8" rowspan="2" valign="top"><label for="frete"></label> <select name="frete" class="form_font form_cor2" id="frete"> <option>R$5,00 - Carta Registrada</option> </select> </td> <td> </td> <td> </td> </tr> <tr> <td height="5"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="20"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td> </td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="21"></td> <td colspan="4" rowspan="8" valign="top"><span class="form_font form01"><strong>Produtos Desejados:</strong><br> ( Copie e cole os títulos dos produtos que você quer comprar nos campos ao lado )</span></td> <td></td> <td colspan="5" valign="top"><label for="produto1"><span class="form_font form_cor2">1.</span></label> <input name="produto1" type="text" class="form_font form_cor2" id="produto1" style="border:1px solid #4d6c98" height="16px"></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="9"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="21"></td> <td></td> <td colspan="5" valign="top"><label for="produto2"><span class="form_font form_cor3">2</span><span class="style12">.</span></label> <input name="produto2" type="text" class="form_font form_cor3" id="produto2" style="border:1px solid #4d6c98" height="16px"></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="9"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="21"></td> <td></td> <td colspan="5" valign="top"><span class="style5"> <span class="form_font form_cor4"> <label for="produto3"><strong>3.</strong></label> </span> </span> <input name="produto3" type="text" class="form_font form_cor4" id="produto3" style="border:1px solid #4d6c98" height="16px"></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="12"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="21"></td> <td></td> <td colspan="5" valign="top"><label for="produto4"><span class="form_font form_cor5">4.</span></label> <input name="produto4" type="text" class="form_font form_cor5" id="produto4" style="border:1px solid #4d6c98" height="16px"></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="19"></td> <td></td> <td> </td> <td> </td> <td> </td> <td> </td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="33"></td> <td></td> <td></td> <td> </td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="24"></td> <td></td> <td></td> <td colspan="4" valign="top"><input name="Submit" type="submit" class="botao_1" value="Enviar"></td> <td> </td> <td valign="top"><input type="reset" name="Submit2" value="Limpar" class="botao_2"></td> <td> </td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="20"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </table></td> <td> </td> <td></td></tr><tr> <td height="11"></td> <td></td> <td></td> <td></td> <td></td></tr></table></form></div></body></html>
Muito Obrigado
Carregando comentários...