Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HTML
- <form method="post" action="contato.php">
- <p>Seu nome: <input type="text" name="nome" size="20" /></p>
- <p>Seu email: <input type="text" name="email" size="20" /></p>
- <p>Escolha o assunto da sua mensagem</p>
- <select size="1" name="assunto">
- <option selected="selected">Selecione</option>
- <option value="pergunta">Pergunta</option>
- <option value="reclamacao">Reclamação</option>
- <option value="suporte">Suporte</option>
- </select>
- <p>Escreva sua mensagem no espaço abaixo:<br />
- <textarea rows="6" name="mensagem" cols="43"></textarea></p>
- <p><input type="submit" value="Enviar" name="enviar" />
- <input name="limpar" type="reset" id="limpar" value="Limpar" />
- </form>
- PHP
- <?php
- $email_destino = array(
- "pergunta" => "lucasandes@gmail.com",
- "reclamacao" => "lucas_sandys@yahoo.com.br",
- "suporte" => "lucasandys@hotmail.com",
- );
- if (isset($_POST['nome']) && (isset($_POST['email']) && (isset($_POST['assunto']) && (isset($_POST['mensagem']))
- { <-------- O ERRO ESTA AQUI
- $nome = $_POST['nome'];
- $email = $_POST['email'];
- $assunto = $_POST['assunto'];
- $mensagem = $_POST['mensagem'];
- }
- else
- {
- echo "Todos os campos devem ser preenchidos!";
- exit;
- }
- $msg = "Nome: $nome\n";
- $msg .= "E-mail: $email\n";
- $msg .= "Mensagem: $mensagem";
- mail($email_destino[$assunto],"Mensagem do site", $msg);
- echo "Sua mensagem foi enviada com sucesso"
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement