Repository navigation
Expand file tree
/
Copy pathcontac.php
More file actions
54 lines (41 loc) · 1.57 KB
/
Copy pathcontac.php
File metadata and controls
54 lines (41 loc) · 1.57 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!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>
<title>Formulari de contacte</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php
$field_name = $_POST['name'];
$field_email = $_POST['email'];
$field_message = $_POST['message'];
$mail_to = 'contacte@edutictac.es';
$subject = 'Message from a site visitor ' . $field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
mail($mail_to, $subject, $body_message, $headers);
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
// Print a message
alert('Moltes gràcies. Li contestarem el més aviat possible.');
// Redirect to some page of the site. You can also specify full URL, e.g. http://template-help.com
window.location = 'index.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
// Print a message
alert('El missatege a fallat. Per favor envia un correu a contacte@edutictac.es');
// Redirect to some page of the site. You can also specify full URL, e.g. http://template-help.com
window.location = 'index.html';
</script>
<?php
}?>
</body>
</html>