
Eliton
Membros-
Total de itens
4 -
Registro em
-
Última visita
Tudo que Eliton postou
-
Formulario html: <form action="form.php" method="POST"> <input type="hidden"> <!-- EMAIL DO DESTINATÁRIO--> <center> <table width="39%" border="0" align="center" cellspacing="0" cellpadding="0"> <tr> <td>Nome:<br> <input type="text" size="30" name="nome" value=""></td> </tr> <tr> <td>E-mail:<br> <input type="text" size="30" name="email" value=""></td> </tr> <tr> <td>Plano assinado :<br> <input type="text" size="30" name="plano" value=""></td> </tr> <tr> <td>Mensagem:<br> <textarea cols="40" rows="10" name="mensagem"></textarea> </td> </tr> <tr> <td> <input name="submit" type="submit" value=" Enviar "> <input name="reset" type="reset" value=" Limpar "></td> </tr> </table> </center> </form> ----------------------------------------------------------------------------------------------------------------------------- FORM.PHP <? $nome = $_POST["nome"]; $email = $_POST["email"]; $plano = $_POST["plano"]; $mensagem = $_POST["mensagem"]; global $email; $data = date("d/m/y"); $ip = $_SERVER['REMOTE_ADDR']; $navegador = $_SERVER['HTTP_USER_AGENT']; $hora = date("H:i"); //AQUI COLOCA SEU E-MAIL mail ("seu@email.com", "$plano", "Nome: $nome\nData: $data\nIp: $ip\nNavegador: $navegador\nHora: $hora\nSite: $site\nE-mail: $email\nTelefone: $fone\n\nMensagem: $mensagem", "From: $email" ); //ENVIA EMAIL PARA O VISITANTE $site = "seu@email.com"; // ESTE EMAIL É QUE VAI APARECE NA CAIXA DO VISITANTE $titulo = "Seu Título"; $msg = "$nome, obrigado por entrar em contato conosco, em breve entraremos em contato"; //AQUI ENVIA UMA AUTORESPOSTA PARA O VISITANTE mail("$email", "$titulo", "$msg", "From: $site" ); echo "<p align=center>$nome, sua mensagem foi enviada com sucesso!</p>"; echo "<p align=center>Estaremos retornando em breve.</p>"; ?>
-
Galera, me ajudem. Eu sou novato em JS. Eu fiz um formulário com o java validando o campo. Tudo bem deu certo no Internet Explorer validou, mais no Mozilla não funfou. No mozilla pode envias em branco que vai. Abaixo vai o código: <script language="JavaScript" type="text/javascript"> <!-- function validacampos(){ var campo = document.forms[0]; var i=0; for (i=0; i<campo.elements.length; i++){ var nomecampo = campo.elements.nome; if (nomecampo.substring(5,0) == 'obrig'){ var valida = campo.elements.value; if (valida == ''){ alert('O campo ' + campo.elements.title + ' deve ser preenchido!'); return false; } } } } //--> </script> <form action="set.php?acao=incluir" method="post" name="inclui" id="inclui" onsubmit="return validacampos();"> <table width="646" height="470" border="0" align="center" cellpadding="0" cellspacing="6" class="geral"> <tr> <td colspan="2" bgcolor="#FF0000" class="geral"><div align="center" class="style12 style15">FICHA DE CADASTRO</div></td> </tr> <tr> <td colspan="2" bgcolor="#FDE3CE" class="geral"> </td> </tr> <tr bgcolor="#FDE3CE"> <td width="29%" align="left" bgcolor="#FDE3CE" class="geral"> Nome :</td> <td width="71%" align="left"> <input name="c1" type="text" class="form" nome="obrigNome" title="Nome" id="c1" size="52" /> </td> </tr> <tr bgcolor="#FDE3CE"> <td align="left" class="geral"> Nascimento:</td> <td width="71%" align="left" bgcolor="#FDE3CE"> <input name="c2" type="text" class="form" nome="obrigNome" title="Dia Nascimento" id="c2" size="1" maxlength="2" /> / <input name="c3" type="text" class="form" nome="obrigNome" title="Mês do Nascimento" id="c3" size="1" maxlength="2" /> / <input name="c4" type="text" class="form" nome="obrigNome" title="Ano do Nascimento" id="c4" size="3" maxlength="4" /> dd/mm/aaaa</td> </tr> <tr bgcolor="#FDE3CE"> <td width="29%" align="left" class="geral"> Endereço:</td> <td width="71%" align="left"> <input name="c5" type="text" class="form" nome="obrigNome" title="Endereço" id="c5" size="52" /> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="29%" align="left" bgcolor="#FDE3CE" class="geral"> Bairro:</td> <td width="71%" align="left" bgcolor="#FDE3CE"> <input name="c6" type="text" class="form" nome="obrigNome" title="Bairro" id="c6" size="52" /> </td> </tr> Tudo bem ele continua, mais eu mandei só um pouco pra mostrar como está. Se alguém pode me ajudar ficarei agradecido. Foi um amigo que me indicou este forum dizendo que só tinha cobra-criada.
-
(Resolvido) Validar formulário PHP
pergunta respondeu ao Eliton de Eliton em Ajax, JavaScript, XML, DOM
Valeu cara hó! Foi mão na roda. Obrigado mesmo -
Galera estou precisando de uma ajuda pra validar este formulário. Ele faz parte de uns script de cadastro de dados em php mais não estou conseguindo fazer com que o javascript valide os campos. alguém de sangue bom poderia me ajudar??? <table width="100%" border="0" cellspacing="0" cellpadding="0" class="geral" align="center"> <tr> <td height="100%"> <form name="inclui" method="post" action="cadcracha/set.php?acao=incluir"> <table width="100%" border="0" cellspacing="6" cellpadding="0" class="geral"> <tr> <td colspan="2" bgcolor="#B8E2CA" class="geral"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Nome :</td> <td width="63%"> <input name="c1" type="text" class="form" id="c1" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> CPF :</td> <td width="63%"> <input name="c2" type="text" class="form" id="c2" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Nome para Crachá:</td> <td width="63%"> <input name="c3" type="text" class="form" id="c3" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Empresa:</td> <td width="63%"> <input name="c4" type="text" class="form" id="c4" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> CNPJ:</td> <td width="63%"> <input name="c5" type="text" class="form" id="c5" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Nome de Fantasia:</td> <td width="63%"><input name="c6" type="text" class="form" id="c6" size="37" /></td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Cargo:</td> <td width="63%"> <input name="c7" type="text" class="form" id="c7" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td> Atividade:</td> <td> <select name="c8" class="form" id="c8"> <option class="form" value="Fabricante">Fabricante</option> <option value="Lojista" selected class="form">Lojista</option> <option class="form" value="Representante">Representante</option> <option class="form" value="Visitante">Visitante</option> </select> </td> </tr> <tr bgcolor="#B8E2CA"> <td class="geral"> Telefone: ( DDD )</td> <td width="63%"><input name="c9" type="text" class="form" id="c9" size="1" maxlength="2" /> - <input name="c10" type="text" class="form" id="c10" size="9" maxlength="9" /></td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Celular: ( DDD )</td> <td width="63%"> <input name="c11" type="text" class="form" id="c11" size="1" maxlength="2"> - <input name="c12" type="text" class="form" id="c12" size="9" maxlength="9"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Email:</td> <td width="63%"> <input name="c13" type="text" class="form" id="c13" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Endereço:</td> <td width="63%"> <input name="c14" type="text" class="form" id="c14" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Complemento:</td> <td width="63%"> <input name="c15" type="text" class="form" id="c15" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Bairro:</td> <td width="63%"> <input name="c16" type="text" class="form" id="c16" size="37"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> Cidade: ( UF )</td> <td width="63%"> <input name="c17" type="text" class="form" id="c17" size="30"> - <input name="c18" type="text" class="form" id="c18" size="1" maxlength="2"> </td> </tr> <tr bgcolor="#B8E2CA"> <td width="37%" class="geral"> CEP:</td> <td width="63%"> <input name="c19" type="text" class="form" id="c19" size="9" maxlength="9"> </td> </tr> <tr bgcolor="#D5DDEC"> <td height="50" colspan="2" bgcolor="#B8E2CA"> <div align="center"> <p> <input type="image" border="0" name="envia" src="cadcracha/img/enviar4.gif" width="58" height="20"> </p> </div> </td> </tr> </table> </form> </td> </tr> </table>