na invullen formulier niet terug
Hopelijk wil iemand deze beginner uit de brand helepen.
Ik heb een formulier in php wat de gegevens doorstuurd naar de e-mailontvanger. Nadat het formulier is ingevuld komt de website niet terug maar krijg ik de melding:
HTTP-fout 404.
Kan iemand mij uitleggen wat ik moet doen om normaal op de site terug te komen, eventueel naar een bedank-pagina?
Bij voorbaat mijn dank, groeten!
Het php bestand:
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
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
<?php
$subject = 'Form Submission'; // Subject of email sent to you.
$emailadd = '[email protected]'; // Your email address. This is where the form information will be sent.
$url = 'www.hierdewebsitenaam.nl'; // Where to redirect after form is processed.
$req = '0'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
$subject = 'Form Submission'; // Subject of email sent to you.
$emailadd = '[email protected]'; // Your email address. This is where the form information will be sent.
$url = 'www.hierdewebsitenaam.nl'; // Where to redirect after form is processed.
$req = '0'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
In jouw geval moet je op regel 7 nog http:// aan de url toevoegen dus: $url = 'http://www.hierdewebsitenaam.nl';
Je hebt gelijk, het probleem is nu verholpen.
Hartelijk dank!
Paul