-
Notifications
You must be signed in to change notification settings - Fork 1
/
contato.php
39 lines (38 loc) · 1.18 KB
/
contato.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php session_start();
if(count($_GET) > 0 || count($_POST) > 0){
define('destino', '[email protected]');
define('titulo', 'titulo do meu email');
$body = '';
foreach ($_REQUEST as $nome => $valor) {
$body .= $nome . ': ' . $valor . "\n";
}
$res = mail(destino, titulo, $body, "From: [email protected]");
if($res){
$_SESSION['aviso'] = 'Formulário enviado com sucesso';
header("Location: contato.php");
die();
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php @include 'headers.php'; ?>
</head>
<body>
<?php @include 'menu1.php'; ?>
<?php if(!empty($_SESSION['aviso'])): ?>
<?php print $_SESSION['aviso']; unset($_SESSION['aviso']); ?>
<?php endif; ?>
<form action="contato.php" method="post">
Nome: <input type="text" name="nome" /><br />
Email: <input type="text" name="email" /><br />
Mensagem:<br />
<textarea name="mensagem"></textarea><br />
<input type="submit" value="enviar" />
</form>
<?php @include 'menu2.php'; ?>
</body>
</html>