checkbox geeft problemen
als newbie probeer ik een contactpagina script te schrijven voor mijn website.
Heb van deze site al een standaard script gebruikt en dit proberen aan te passen de verschillende tutorials volgende.(of dat probeer ik toch)
Helaas krijg ik een foutmelding bij de checkbox en krijg ik het probleem niet opgelost.
Kunnen jullie mij helpen?
Alvast bedankt!
hier de HTML code
<form action="http://www.??????.be/post.php" method="post">
<li><input name="voornaam" type="text" class="input require" value="Voornaam*" onFocus="if(this.value == 'Voornaam*') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Voornaam*';}" /></li>
<li><input name="naam" type="text" class="input require" value="Naam*" onFocus="if(this.value == 'Naam*') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Naam*';}" /></li>
<input name="bedrijfsnaam" type="text" class="input" value="Bedrijfsnaam" onFocus="if(this.value == 'Bedrijfsnaam') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Bedrijfsnaam';}" /></li>
<input name="e-mail" type="text" class="input require" value="E-mail*" onFocus="if(this.value == 'E-mail*') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'E-mail*';}" /></li>
<li><input name="adres" type="text" class="input" value="Straat & Nr (Bus)" onFocus="if(this.value == 'Straat & Nr (Bus)') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Straat & Nr (Bus)';}" /></li>
<li><input name="gemeente" type="text" class="input" value="Postcode + Stad" onFocus="if(this.value == 'Postcode + Stad') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'postcode + Stad';}" /></li>
<li><input name="tel" type="text" class="input" value="Telefoon en/of Gsm" onFocus="if(this.value == 'Telefoon en/of Gsm') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Telefoon en/of Gsm';}" /></li>
<div class="info">
<aside>
<label>Omschrijf kort uw Event, project, gelegenheid, ...</label>
<textarea name="omschrijving" cols="" rows="1" class="textarea"></textarea>
</aside>
<aside>
<aside class="projects">
<label class="omvat"><br>- Welk type animatie zoekt u:</label>
</aside>
<ul>
<li><input name="dienst1" type="checkbox" value="animatie" class="checkbox"> Kinderanimatie</li>
<li><input name="dienst2" type="checkbox" value="show" class="checkbox"> Kindershow - Kindertheater</li>
</ul>
<ul>
<li><input name="dienst3" type="checkbox" value="catering" class="checkbox"> Catering 4 Kids</li>
<li><input name="dienst4" type="checkbox" value="marketing" class="checkbox"> Marketing 4 Kids</li>
</ul>
<ul>
<li><input name="dienst5" type="checkbox" value="events" class="checkbox"> Bedrijfsevent</li>
<li><input name="dienst6" type="checkbox" value="verjaardag" class="checkbox"> Verjaardagsfeest</li>
</ul>
<ul class="last">
<li><input name="dienst7" type="checkbox" value="communie" class="checkbox"> Communie of Familiefeest</li>
<li><input name="dienst8" type="checkbox" value="maatwerk" class="checkbox"> Maatwerk</li>
<li><input name="dienst9" type="checkbox" value="andere" class="checkbox"> Andere...<li/>
<li></li>
</ul>
</aside>
<p><br></br></p>
</fieldset>
<div class="rightcontent">
<label>- Extra Informatie:</label>
<ul>
<li><input name="datum" type="text" class="input" value="Datum" onFocus="if(this.value == 'Datum') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Datum';}" /></li>
<li><input name="aantal" type="text" class="input" value="Aantal" onFocus="if(this.value == 'Aantal') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Aantal';}" /></li>
<li><input name="locatie" type="text" class="input" value="Locatie" onFocus="if(this.value == 'Locatie') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Locatie';}" /></li>
<li><input name="uren" type="text" class="input" value="Uren" onFocus="if(this.value == 'Uren') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Uren';}" /></li>
<li><input name="andere3" type="text" class="input" value="Andere" onFocus="if(this.value == 'Andere') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Andere';}" /></li>
</ul>
<fieldset>
<p><br></p>
<h4>Nog een laatste vraagje dan! Hoe heeft u ons ontdekt?</h4>
<div class="info">
<p><input name="ontdekking1" type="checkbox" value="Via google" class="checkbox"> Via google <span>/</span>
<input name="ontdekking2" type="checkbox" value="Via vrienden" class="checkbox"> Via vrienden <span>/</span>
<input name="ontdekking3" type="checkbox" value="Via advertentie" class="checkbox"> Via advertentie <span>/</span>
<input name="ontdekking4" type="checkbox" value="Social Media (facebook, twitter, ...)" class="checkbox"> Social Media (facebook, twitter, ...)
</p>
</div>
<p><br></br></p>
<input name="submit" type="submit" class="submit" value=" Verzend aanvraag prijsofferte " />
</fieldset>
</form>
en hier het script:
Code (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
session_start();
$mail_ontv = 'info@??????';
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (empty($_POST['naam']))
$naam_fout = 1;
if (function_exists('filter_var') && !filter_var($_POST['mail'], FILTER_VALIDATE_EMAIL))
$email_fout = 1;
if (!empty($_SESSION['antiflood']))
{
$seconde = 20;
$tijd = time() - $_SESSION['antiflood'];
if($tijd < $seconde)
$antiflood = 1;
}
}
if (($_SERVER['REQUEST_METHOD'] == 'POST' && (!empty($antiflood) || empty($_POST['naam']) || !empty($naam_fout) || empty($_POST['mail']) || !empty($email_fout) || empty($_POST['bericht']) || empty($_POST['onderwerp']))) || $_SERVER['REQUEST_METHOD'] == 'GET')
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (!empty($voornaam_fout))
echo '<p>Uw voornaam is niet ingevuld.</p>';
if (!empty($naam_fout))
echo '<p>Uw naam is niet ingevuld.</p>';
elseif (!empty($email_fout))
echo '<p>Uw e-mailadres is niet juist.</p>';
elseif (!empty($antiflood))
echo '<p>U mag slechts één bericht per ' . $seconde . ' seconde versturen.</p>';
else
echo '<p>U bent uw naam, e-mailadres, onderwerp of bericht vergeten in te vullen.</p>';
}
// HTML e-mail formulier
echo '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" />
<p>
<label for="voornaam">Voornaam:</label><br />
<input type="text" id="voornaam" name="voornaam" value="' . (isset($_POST['voornaam']) ? htmlspecialchars($_POST['voornaam']) : '') . '" /><br />
<label for="naam">Naam:</label><br />
<input type="text" id="naam" name="naam" value="' . (isset($_POST['naam']) ? htmlspecialchars($_POST['naam']) : '') . '" /><br />
<label for="Bedrijfsnaam">Bedrijfsnaam:</label><br />
<input type="text" id="Bedrijfsnaam" name="Bedrijfsnaam" value="' . (isset($_POST['bedrijfsnaam']) ? htmlspecialchars($_POST['bedrijfsnaam']) : '') . '" /><br />
<label for="E-mail">E-mail:</label><br />
<input type="text" id="E-mail" name="E-mail" value="' . (isset($_POST['e-mail']) ? htmlspecialchars($_POST['e-mail']) : '') . '" /><br />
<label for="Adres">adres:</label><br />
<input type="text" id="adres" name="adres" value="' . (isset($_POST['adres']) ? htmlspecialchars($_POST['adres']) : '') . '" /><br />
<label for="gemeente">gemeente:</label><br />
<input type="text" id="gemeente" name="gemeente" value="' . (isset($_POST['gemeente']) ? htmlspecialchars($_POST['gemeente']) : '') . '" /><br />
<label for="tel">tel:</label><br />
<input type="text" id="tel" name="tel" value="' . (isset($_POST['tel']) ? htmlspecialchars($_POST['tel']) : '') . '" /><br />
<label for="omschrijving">omschrijving:</label><br />
<textarea id="omschrijving" name="omschrijving" rows="8" style="width: 400px;">' . (isset($_POST['omschrijving']) ? htmlspecialchars($_POST['omschrijving']) : '') . '</textarea><br />
$dienst1= $_POST['animatie'];
$dienst2= $_POST['Kindershow - Kindertheater'];
$dienst3= $_POST['Catering'];
$dienst4= $_POST['Marketing'];
$dienst5= $_POST['Bedrijfsevent'];
$dienst6= $_POST['verjaardagfeest'];
$dienst7= $_POST['Communie of familiefeest'];
$dienst8= $_POST['Maatwerk'];
$dienst9= $_POST['Andere'];
echo 'Welk type animatie zoekt u' . '<br>';
if (isset($dienst1)){
echo 'Animatie' . '<br>';
}
if (isset($dienst2)){
echo 'Kindershow - Kindertheater'. '<br>';
}
if (isset($dienst3)){
echo 'Catering' . '<br>';
}
if (isset($dienst4)){
echo 'Marketing' . '<br>';
}
if (isset($dienst5)){
echo 'Bedrijfsevent' . '<br>';
}
if (isset($dienst6)){
echo 'Verjaardagfeest' . '<br>';
}
if (isset($dienst7)){
echo 'Communie - familiefeest' . '<br>';
}
if (isset($dienst8)){
echo 'Maatwerk' . '<br>';
}
if (isset($dienst9)){
echo 'Andere' . '<br>';
}
if ((empty($dienst1)) && (empty($dienst2)) && (empty($dienst3)) && (empty($dienst4)) && (empty($dienst5)) && (empty($dienst6)) && (empty($dienst7)) && (empty($dienst8)) && (empty($dienst9))){
echo 'No activities chosen yet';
}
echo 'Extra Informatie' . '<br>';
<label for="datum">Datum:</label><br />
<input type="text" id="datum" name="datum" value="' . (isset($_POST['datum']) ? htmlspecialchars($_POST['datum']) : '') . '" /><br />
<label for="aantal">aantal:</label><br />
<input type="text" id="aantal" name="aantal" value="' . (isset($_POST['aantal']) ? htmlspecialchars($_POST['aantal']) : '') . '" /><br />
<label for="locatie">locatie:</label><br />
<input type="text" id="locatie" name="locatie" value="' . (isset($_POST['locatie']) ? htmlspecialchars($_POST['locatie']) : '') . '" /><br />
<label for="uren">uren:</label><br />
<input type="text" id="uren" name="uren" value="' . (isset($_POST['uren']) ? htmlspecialchars($_POST['uren']) : '') . '" /><br />
<label for="andere3">Andere3:</label><br />
<input type="text" id="andere3" name="andere3" value="' . (isset($_POST['andere3']) ? htmlspecialchars($_POST['andere3']) : '') . '" /><br />
echo 'Hoe heeft u just us ontdekt?' . '<br>';
$ontdekking1= $_POST['via Google'];
$ontdekking2= $_POST['via vrienden'];
$ontdekking3= $_POST['via advertentie'];
$ontdekking4= $_POST['via social media'];
if (isset($dienst1)){
echo 'Via Google' . '<br>';
}
if (isset($dienst2)){
echo 'Via vrienden'. '<br>';
}
if (isset($dienst3)){
echo 'Via advertentie' . '<br>';
}
if (isset($dienst4)){
echo 'Via social media' . '<br>';
}
if ((empty($dienst1)) && (empty($dienst2)) && (empty($dienst3)) && (empty($dienst4))){
echo 'No activities chosen yet';
}
<input type="submit" name="submit" value=" Versturen " />
</p>
</form>';
}
else
{
$datum = date('d/m/Y H:i:s');
$inhoud_mail = "===================================================\n";
$inhoud_mail .= "Ingevulde contact formulier " . $_SERVER['HTTP_HOST'] . "\n";
$inhoud_mail .= "===================================================\n\n";
$inhoud_mail .= "Naam: " . htmlspecialchars($_POST['naam']) . "\n";
$inhoud_mail .= "E-mail adres: " . htmlspecialchars($_POST['mail']) . "\n";
$inhoud_mail .= "Bericht:\n";
$inhoud_mail .= htmlspecialchars($_POST['bericht']) . "\n\n";
$inhoud_mail .= "Verstuurd op " . $datum . " via het IP adres " . $_SERVER['REMOTE_ADDR'] . "\n\n";
$inhoud_mail .= "===================================================\n\n";
$headers = 'From: ' . htmlspecialchars($_POST['naam']) . ' <' . $_POST['mail'] . '>';
$headers = stripslashes($headers);
$headers = str_replace('\n', '', $headers); // Verwijder \n
$headers = str_replace('\r', '', $headers); // Verwijder \r
$headers = str_replace("\"", "\\\"", str_replace("\\", "\\\\", $headers)); // Slashes van quotes
$_POST['onderwerp'] = str_replace('\n', '', $_POST['onderwerp']); // Verwijder \n
$_POST['onderwerp'] = str_replace('\r', '', $_POST['onderwerp']); // Verwijder \r
$_POST['onderwerp'] = str_replace("\"", "\\\"", str_replace("\\", "\\\\", $_POST['onderwerp'])); // Slashes van quotes
if (mail($mail_ontv, $_POST['onderwerp'], $inhoud_mail, $headers))
{
$_SESSION['antiflood'] = time();
echo '<h1>Het contactformulier is verzonden</h1>
<p>Bedankt voor het invullen van het contactformulier. We zullen zo spoedig mogelijk contact met u opnemen.</p>';
}
else
{
echo '<h1>Het contactformulier is niet verzonden</h1>
<p><b>Onze excuses.</b> Het contactformulier kon niet verzonden worden.</p>';
}
}
?>
session_start();
$mail_ontv = 'info@??????';
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (empty($_POST['naam']))
$naam_fout = 1;
if (function_exists('filter_var') && !filter_var($_POST['mail'], FILTER_VALIDATE_EMAIL))
$email_fout = 1;
if (!empty($_SESSION['antiflood']))
{
$seconde = 20;
$tijd = time() - $_SESSION['antiflood'];
if($tijd < $seconde)
$antiflood = 1;
}
}
if (($_SERVER['REQUEST_METHOD'] == 'POST' && (!empty($antiflood) || empty($_POST['naam']) || !empty($naam_fout) || empty($_POST['mail']) || !empty($email_fout) || empty($_POST['bericht']) || empty($_POST['onderwerp']))) || $_SERVER['REQUEST_METHOD'] == 'GET')
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (!empty($voornaam_fout))
echo '<p>Uw voornaam is niet ingevuld.</p>';
if (!empty($naam_fout))
echo '<p>Uw naam is niet ingevuld.</p>';
elseif (!empty($email_fout))
echo '<p>Uw e-mailadres is niet juist.</p>';
elseif (!empty($antiflood))
echo '<p>U mag slechts één bericht per ' . $seconde . ' seconde versturen.</p>';
else
echo '<p>U bent uw naam, e-mailadres, onderwerp of bericht vergeten in te vullen.</p>';
}
// HTML e-mail formulier
echo '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" />
<p>
<label for="voornaam">Voornaam:</label><br />
<input type="text" id="voornaam" name="voornaam" value="' . (isset($_POST['voornaam']) ? htmlspecialchars($_POST['voornaam']) : '') . '" /><br />
<label for="naam">Naam:</label><br />
<input type="text" id="naam" name="naam" value="' . (isset($_POST['naam']) ? htmlspecialchars($_POST['naam']) : '') . '" /><br />
<label for="Bedrijfsnaam">Bedrijfsnaam:</label><br />
<input type="text" id="Bedrijfsnaam" name="Bedrijfsnaam" value="' . (isset($_POST['bedrijfsnaam']) ? htmlspecialchars($_POST['bedrijfsnaam']) : '') . '" /><br />
<label for="E-mail">E-mail:</label><br />
<input type="text" id="E-mail" name="E-mail" value="' . (isset($_POST['e-mail']) ? htmlspecialchars($_POST['e-mail']) : '') . '" /><br />
<label for="Adres">adres:</label><br />
<input type="text" id="adres" name="adres" value="' . (isset($_POST['adres']) ? htmlspecialchars($_POST['adres']) : '') . '" /><br />
<label for="gemeente">gemeente:</label><br />
<input type="text" id="gemeente" name="gemeente" value="' . (isset($_POST['gemeente']) ? htmlspecialchars($_POST['gemeente']) : '') . '" /><br />
<label for="tel">tel:</label><br />
<input type="text" id="tel" name="tel" value="' . (isset($_POST['tel']) ? htmlspecialchars($_POST['tel']) : '') . '" /><br />
<label for="omschrijving">omschrijving:</label><br />
<textarea id="omschrijving" name="omschrijving" rows="8" style="width: 400px;">' . (isset($_POST['omschrijving']) ? htmlspecialchars($_POST['omschrijving']) : '') . '</textarea><br />
$dienst1= $_POST['animatie'];
$dienst2= $_POST['Kindershow - Kindertheater'];
$dienst3= $_POST['Catering'];
$dienst4= $_POST['Marketing'];
$dienst5= $_POST['Bedrijfsevent'];
$dienst6= $_POST['verjaardagfeest'];
$dienst7= $_POST['Communie of familiefeest'];
$dienst8= $_POST['Maatwerk'];
$dienst9= $_POST['Andere'];
echo 'Welk type animatie zoekt u' . '<br>';
if (isset($dienst1)){
echo 'Animatie' . '<br>';
}
if (isset($dienst2)){
echo 'Kindershow - Kindertheater'. '<br>';
}
if (isset($dienst3)){
echo 'Catering' . '<br>';
}
if (isset($dienst4)){
echo 'Marketing' . '<br>';
}
if (isset($dienst5)){
echo 'Bedrijfsevent' . '<br>';
}
if (isset($dienst6)){
echo 'Verjaardagfeest' . '<br>';
}
if (isset($dienst7)){
echo 'Communie - familiefeest' . '<br>';
}
if (isset($dienst8)){
echo 'Maatwerk' . '<br>';
}
if (isset($dienst9)){
echo 'Andere' . '<br>';
}
if ((empty($dienst1)) && (empty($dienst2)) && (empty($dienst3)) && (empty($dienst4)) && (empty($dienst5)) && (empty($dienst6)) && (empty($dienst7)) && (empty($dienst8)) && (empty($dienst9))){
echo 'No activities chosen yet';
}
echo 'Extra Informatie' . '<br>';
<label for="datum">Datum:</label><br />
<input type="text" id="datum" name="datum" value="' . (isset($_POST['datum']) ? htmlspecialchars($_POST['datum']) : '') . '" /><br />
<label for="aantal">aantal:</label><br />
<input type="text" id="aantal" name="aantal" value="' . (isset($_POST['aantal']) ? htmlspecialchars($_POST['aantal']) : '') . '" /><br />
<label for="locatie">locatie:</label><br />
<input type="text" id="locatie" name="locatie" value="' . (isset($_POST['locatie']) ? htmlspecialchars($_POST['locatie']) : '') . '" /><br />
<label for="uren">uren:</label><br />
<input type="text" id="uren" name="uren" value="' . (isset($_POST['uren']) ? htmlspecialchars($_POST['uren']) : '') . '" /><br />
<label for="andere3">Andere3:</label><br />
<input type="text" id="andere3" name="andere3" value="' . (isset($_POST['andere3']) ? htmlspecialchars($_POST['andere3']) : '') . '" /><br />
echo 'Hoe heeft u just us ontdekt?' . '<br>';
$ontdekking1= $_POST['via Google'];
$ontdekking2= $_POST['via vrienden'];
$ontdekking3= $_POST['via advertentie'];
$ontdekking4= $_POST['via social media'];
if (isset($dienst1)){
echo 'Via Google' . '<br>';
}
if (isset($dienst2)){
echo 'Via vrienden'. '<br>';
}
if (isset($dienst3)){
echo 'Via advertentie' . '<br>';
}
if (isset($dienst4)){
echo 'Via social media' . '<br>';
}
if ((empty($dienst1)) && (empty($dienst2)) && (empty($dienst3)) && (empty($dienst4))){
echo 'No activities chosen yet';
}
<input type="submit" name="submit" value=" Versturen " />
</p>
</form>';
}
else
{
$datum = date('d/m/Y H:i:s');
$inhoud_mail = "===================================================\n";
$inhoud_mail .= "Ingevulde contact formulier " . $_SERVER['HTTP_HOST'] . "\n";
$inhoud_mail .= "===================================================\n\n";
$inhoud_mail .= "Naam: " . htmlspecialchars($_POST['naam']) . "\n";
$inhoud_mail .= "E-mail adres: " . htmlspecialchars($_POST['mail']) . "\n";
$inhoud_mail .= "Bericht:\n";
$inhoud_mail .= htmlspecialchars($_POST['bericht']) . "\n\n";
$inhoud_mail .= "Verstuurd op " . $datum . " via het IP adres " . $_SERVER['REMOTE_ADDR'] . "\n\n";
$inhoud_mail .= "===================================================\n\n";
$headers = 'From: ' . htmlspecialchars($_POST['naam']) . ' <' . $_POST['mail'] . '>';
$headers = stripslashes($headers);
$headers = str_replace('\n', '', $headers); // Verwijder \n
$headers = str_replace('\r', '', $headers); // Verwijder \r
$headers = str_replace("\"", "\\\"", str_replace("\\", "\\\\", $headers)); // Slashes van quotes
$_POST['onderwerp'] = str_replace('\n', '', $_POST['onderwerp']); // Verwijder \n
$_POST['onderwerp'] = str_replace('\r', '', $_POST['onderwerp']); // Verwijder \r
$_POST['onderwerp'] = str_replace("\"", "\\\"", str_replace("\\", "\\\\", $_POST['onderwerp'])); // Slashes van quotes
if (mail($mail_ontv, $_POST['onderwerp'], $inhoud_mail, $headers))
{
$_SESSION['antiflood'] = time();
echo '<h1>Het contactformulier is verzonden</h1>
<p>Bedankt voor het invullen van het contactformulier. We zullen zo spoedig mogelijk contact met u opnemen.</p>';
}
else
{
echo '<h1>Het contactformulier is niet verzonden</h1>
<p><b>Onze excuses.</b> Het contactformulier kon niet verzonden worden.</p>';
}
}
?>
Nog wat andere opmerkingen:
Niet zo lang geleden had iemand eenzelfde opbouw van het script als jij:
Regel 6 t/m 22 controleren of een formulier is verzonden en er geen lege velden zijn. Daarna nog een keer controleren of het formulier verzonden is (controle op $_POST en $_GET?!?) en of variabelen leeg zijn. Om daarna nogmaals te controleren of een formulier is verzonden en bij een aantal variabelen een foutmelding aan te maken.
Lijkt mij allemaal wat dubbelop.
Op regel 69 - 77 maak je een hoop variabelen aan (waarom?) zonder te controleren of die bestaan. Vervolgens doe je wel een controle met isset, maar als ik het goed heb, zal die altijd WAAR opleveren; je hebt die variabelen immers net aangemaakt...
Bedenk goede namen voor variabelen. Weet jij volgende week of maand nog wat $dienst7 is? (los daarvan: je maakt nu onnodig variabelen aan, want je hebt de $_POST waarden immers).
Voor een goede opbouw:
Eerst php, dan HTML. In PHP controleer je of het formulier verzonden is en voer je andere controles uit en verzorgt (indien aan alle voorwaarden wordt voldaan) de verzending van de mail. Je hebt nu van alles door elkaar.
Grote kans dat in je mail-functie de juiste headers ontbreken. kan betekenen dat mail niet aankomt of in de spam-box. Gebruik om te voorkomen dat je het wiel opnieuw gaat uitvinden bv swiftmailer of phpmailer.
Zet error-reporting aan.