Ik heb net ff geprobeerd een PHP mail formuliertje te maken maar is mij nog niet helemaal goed gelukt.
Ik wil controleren of ze alles hebben ingevuld maar dat werkt niet goed als ze niks invullen dan mail hij hem wel.
Er moet ook komen te staan dat de email is gestuurd hoe doe ik dat?
Hieronder de code:
Ik wil controleren of ze alles hebben ingevuld maar dat werkt niet goed als ze niks invullen dan mail hij hem wel.
Er moet ook komen te staan dat de email is gestuurd hoe doe ik dat?
Hieronder de code:
code:
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
| <?php
if (isset($_POST['verzenden'])) {
if (!isset($_POST['email'])) {
$error = "Geen geldig e-mail adres ingevuld<BR />";
} if (!isset($_POST['naam'])) {
$error .= "Naam is niet ingevuld<BR />";
} if (!isset($_POST['bericht'])) {
$error .= "U heeft geen bericht ingevuld<BR />";
}
if (!isset($error)) {
$bericht = "Naam : " .$_POST['naam']. "
E-mail : ".$_POST['email']. "
Bericht : ".$_POST['bericht']. " \n";
mail ("****@gmail.com", "Bericht van je website", $bericht, "FROM: Je website");
} else {
echo "Gelieve alle velden netjes in te vullen!";
}
} else {
echo "<FONT COLOR=\"#FF0000\">".$error."</FONT>";
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="copyright" content="Ronald van Butselaar ">
<title>Michiel van Butselaar</title>
<link href="midden.css" rel="stylesheet" type="text/css" media="all">
</head>
<body bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
<p></p>
<p>E-mail Michiel</p>
<form id="mailForm" method="post" name="mailForm">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="130">E-mail:</td>
<td width="303"><input type="text" name="email" value="Vul hier uw e-mail adres in." size="24" maxlength="50"></td>
</tr>
<tr>
<td width="130">Naam:</td>
<td width="303"><input type="text" name="naam" value="Vul hier uw naam in." size="24" maxlength="50"></td>
</tr>
<tr>
<td valign="top" width="130">Bericht:</td>
<td width="303"><textarea name="bericht" rows="5" cols="40">Type hier het bericht.</textarea></td>
</tr>
<tr>
<td width="130"></td>
<td width="303"><input type="submit" name="verzenden" value="Verzenden"> <input type="reset" value="Wissen"></td>
</tr>
</table>
</form>
<p></p>
</body>
</html> |