-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvolunteer_request.php
82 lines (66 loc) · 3.28 KB
/
volunteer_request.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
require_once("util/constants.php");
include("util/connection.php");
include("util/command.php");
echo "<script src='https://code.jquery.com/jquery-3.6.4.min.js'></script>";
echo WEBALL;
echo "<script src='script/script.js'></script>";
echo "<script type='text/javascript'src='https://cdn.jsdelivr.net/npm/@emailjs/browser@4/dist/email.min.js'></script>";
echo "<script type='text/javascript'> emailjs.init('cx_DHiqEbFqDomUtu') </script>";
echo "<link rel='stylesheet' href='style/style.css'>";
echo "<title>Associazione Zero Tre</title>";
session_start();
nav_menu2();
echo "<br>
<section id='form'>
<h2>Vuoi diventare un volontario dell'associazione? <br>Compila il form e ti ricontatteremo</h2>
<form name='volunteer_request' action='private/send_email.php' id='volunteer_request' method='POST'>
<br><br>
<div class='div__label'>
<label for='name'>Inserisci il tuo nome *</label>
<label for='surname'>Inserisci il tuo cognome *</label>
</div>
<div class='div__input'>
<input type='text' name='name' id='name' required>
<input type='text' name='surname' id='surname' required>
</div>
<label for='email'>Inserisci la tua email *</label>
<input type='email' name='email' id='email'>
<div class='div__label'>
<label for='tf'>Inserisci il numero di telefono fisso</label>
<label for='tm'>Inserisci il numero di telefono mobile *</label>
</div>
<div class='div__input'>
<input type='number' name='tf' id='tf'>
<input type='number' name='tm' id='tm' required>
</div>
<label for='info'>Parlaci un po' di te</label>
<textarea name='info' id='info' cols='30' rows='10' placeholder='Dicci qualcosa su di te'></textarea>
<input type='submit' value='INVIA' id='send_form'>
</form>
</section>";
// js per invio dell'email tramite utilizzo di WS fornito da EmailJS
echo " <script>
const btn = document.getElementById('send_form');
document.getElementById('volunteer_request').addEventListener('submit', function (e) {
e.preventDefault();
btn.value = 'Invio...';
const serviceID = 'default_service';
const templateID = 'template_fuonb84';
emailjs.sendForm(serviceID, templateID, this)
.then(() => {
btn.value = 'Inviato';
alert('Email inviata correttamente, ti ricontatteremo presto!');
this.reset();
btn.value = 'Invia';
}, (err) => {
btn.value = 'Errore';
alert(JSON.stringify(err));
btn.value = 'Invia';
});
});
</script>";
show_footer();
?>