Fout in code?
Ik heb een vraag betreft onderstaande code.
ik heb dit script van hier verkregen, echter gebeurd er niets wanneer ik op verzend klik, zou iemand hier naar kunnen kijken, want mijn ervaring met php is vrij klein.
voor een voorbeeld, zoals hij nu uitgevoerd word:
http://firgurth.nl/praetorian/?pagina=application_sent
De code hieronder:
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
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
<?php
$naar = '[email protected]'; // Verander hier [email protected] naar uw eigen email adress.
if(isset($_POST['verzend'])) // Als het bericht verzonden is
{
if($_POST['name'] == '') // Als het veld naam leeg is
{
echo "You did not fill in your Charactername!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['class'] == '') // Als het veld class leeg is.
{
echo "You did not fill in your class!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['specialization'] == '') // Als er geen specialization is ingevuld.
{
echo "Please fill in your Specialization!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['armorylink'] == '') // Als er geen armorylink is ingevuld
{
echo "Please enter your armorylink!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['level'] == '') // Als het level level leeg is.
{
echo "You did not fill in your level!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['expect'] == '') // Als het veld expectations leeg is.
{
echo "You did not fill in your expectations<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['contact'] == '') // Als het veld contact leeg is.
{
echo "Please tell us how you did got contact with us!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['experience'] == '') // Als het veld experience leeg is.
{
echo "You did not fill in your experiences!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['agree'] == '') // Als het agreement leeg is.
{
echo "You have to agree our rules!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['profession'] == '') // Als het veld proffessions leeg is.
{
echo "You did not fill in if you would reroll!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['ventrilo'] == '') // Als het veld ventrilo leeg is.
{
echo "You did not fill in if you can use Ventrilo!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
else
{
// Mailen:
$bericht = "
<html>
<head>
<title>Contact fomulier</title>
</head>
<body>
<table border='0' width='50%'>
<tr>
<td width='20%'>Charactername:</td>
<td>".$_POST['name']."</td>
</tr>
<tr>
<td width='20%'>Class:</td>
<td>".$_POST['class']."</td>
</tr>
<tr>
<td width='20%'>Specialization:</td>
<td>".$_POST['specialization']."</td>
</tr>
<tr>
<td width='20%'>Armorylink:</td>
<td>".$_POST['armorylink']."</td>
</tr>
<tr>
<td width='20%'>level:</td>
<td>".$_POST['level']."</td>
</tr>
<tr>
<td width='20%'>Expectations:</td>
<td>".$_POST['expect']."</td>
</tr>
<tr>
<td width='20%'>Experiences</td>
<td>".$_POST['experience']."</td>
</tr>
<tr>
<td width='20%'>Profeesions:</td>
<td>".$_POST['proffession']."</td>
</tr>
<tr>
<td width='20%'>Ventrilo:</td>
<td>".$_POST['ventrilo']."</td>
</tr>
</table>
</body>
</html>
";
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: ".$_POST['name']." <".$_POST['class'].">\r\n";
// Headers, zodat we html kunnen gebruiken in de mail, en van wie de mail komt.
if(mail($naar, $_POST['name'],$bericht,$headers)) // Als de mail naar de maker is verstuurd
{
echo 'Your application has been send!';
}
else // Anders
{
echo 'Your application has not been send.';
}
$ond = "Your application has been send!". $naar;
if(mail($naar, $ond,$bericht,$headers)) // Als de mail naar de verzender is verstuurd
{
echo 'Your application has been send';
}
else // Anders
{
echo 'Your application is not send.';
}
}
}
else
{
?>
<!-- Formulier weergeven -->
<table id="recruitment_apply">
<h2>Application to Praetorian</h2>
<tr><td>Charactername</td><td><input size="20" maxlength="10" type="text" name="name" value=" " style="color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
<tr><td>Class</td><td><input size="20" maxlength="7" type="text" name="class" value=" " style="color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
<tr><td>Armory Link</td><td><input size="20" maxlength="100" type="text" name="armorylink" value=" " style="color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
<tr><td>Level</td><td><input size="2" maxlength="2" type="text" name="level" value="70" style="color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>What do you expect of Praetorian? And what can we expect of you?</td></tr>
<tr><td><textarea cols="20" rows="3" name="expect" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>How did you get in contact with Praetorian?</td></tr>
<tr><td><textarea cols="20" rows="3" name="contact" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>What kind of raid experience do you have(TBC and Pre- TBC)?</td></tr>
<tr><td><textarea cols="20" rows="3" name="experience" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>Are you willing to reroll professions for the sake of guild progression and character improvement?</td></tr>
<tr><td><textarea cols="20" rows="3" name="proffession" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>Are you able to use Ventrillo, do you have a microphone <br />and do you know how to use it?</td></tr>
<tr><td><textarea cols="20" rows="3" name="ventrilo" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td><INPUT TYPE="checkbox" NAME="agree" VALUE=" Yes" ></td><td style="font-size: 10px;">I have read and i agree the <a href="?pagina=recruitment_rules">recruitment rules</a> and the <a href="?pagina=raiding_rules">raiding rules</a>.</td></tr>
</table>
<table id="recruitment_apply">
<tr><td><input size="10" maxlength="10" type="Submit" name="verzend" value="Apply" style="color : rgb(173, 146, 74); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td><td><input size="10" maxlength="10" type="reset" name="reset" value="Reset" style="color : rgb(173, 146, 74); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
</table>
<?php
}
?>
$naar = '[email protected]'; // Verander hier [email protected] naar uw eigen email adress.
if(isset($_POST['verzend'])) // Als het bericht verzonden is
{
if($_POST['name'] == '') // Als het veld naam leeg is
{
echo "You did not fill in your Charactername!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['class'] == '') // Als het veld class leeg is.
{
echo "You did not fill in your class!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['specialization'] == '') // Als er geen specialization is ingevuld.
{
echo "Please fill in your Specialization!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['armorylink'] == '') // Als er geen armorylink is ingevuld
{
echo "Please enter your armorylink!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['level'] == '') // Als het level level leeg is.
{
echo "You did not fill in your level!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['expect'] == '') // Als het veld expectations leeg is.
{
echo "You did not fill in your expectations<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['contact'] == '') // Als het veld contact leeg is.
{
echo "Please tell us how you did got contact with us!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['experience'] == '') // Als het veld experience leeg is.
{
echo "You did not fill in your experiences!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['agree'] == '') // Als het agreement leeg is.
{
echo "You have to agree our rules!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['profession'] == '') // Als het veld proffessions leeg is.
{
echo "You did not fill in if you would reroll!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
elseif($_POST['ventrilo'] == '') // Als het veld ventrilo leeg is.
{
echo "You did not fill in if you can use Ventrilo!<br />";
echo "<a href='javascript:history.back();' style='color: black; text-decoration:none;'>Click to go back!</a>";
}
else
{
// Mailen:
$bericht = "
<html>
<head>
<title>Contact fomulier</title>
</head>
<body>
<table border='0' width='50%'>
<tr>
<td width='20%'>Charactername:</td>
<td>".$_POST['name']."</td>
</tr>
<tr>
<td width='20%'>Class:</td>
<td>".$_POST['class']."</td>
</tr>
<tr>
<td width='20%'>Specialization:</td>
<td>".$_POST['specialization']."</td>
</tr>
<tr>
<td width='20%'>Armorylink:</td>
<td>".$_POST['armorylink']."</td>
</tr>
<tr>
<td width='20%'>level:</td>
<td>".$_POST['level']."</td>
</tr>
<tr>
<td width='20%'>Expectations:</td>
<td>".$_POST['expect']."</td>
</tr>
<tr>
<td width='20%'>Experiences</td>
<td>".$_POST['experience']."</td>
</tr>
<tr>
<td width='20%'>Profeesions:</td>
<td>".$_POST['proffession']."</td>
</tr>
<tr>
<td width='20%'>Ventrilo:</td>
<td>".$_POST['ventrilo']."</td>
</tr>
</table>
</body>
</html>
";
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: ".$_POST['name']." <".$_POST['class'].">\r\n";
// Headers, zodat we html kunnen gebruiken in de mail, en van wie de mail komt.
if(mail($naar, $_POST['name'],$bericht,$headers)) // Als de mail naar de maker is verstuurd
{
echo 'Your application has been send!';
}
else // Anders
{
echo 'Your application has not been send.';
}
$ond = "Your application has been send!". $naar;
if(mail($naar, $ond,$bericht,$headers)) // Als de mail naar de verzender is verstuurd
{
echo 'Your application has been send';
}
else // Anders
{
echo 'Your application is not send.';
}
}
}
else
{
?>
<!-- Formulier weergeven -->
<table id="recruitment_apply">
<h2>Application to Praetorian</h2>
<tr><td>Charactername</td><td><input size="20" maxlength="10" type="text" name="name" value=" " style="color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
<tr><td>Class</td><td><input size="20" maxlength="7" type="text" name="class" value=" " style="color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
<tr><td>Armory Link</td><td><input size="20" maxlength="100" type="text" name="armorylink" value=" " style="color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
<tr><td>Level</td><td><input size="2" maxlength="2" type="text" name="level" value="70" style="color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>What do you expect of Praetorian? And what can we expect of you?</td></tr>
<tr><td><textarea cols="20" rows="3" name="expect" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>How did you get in contact with Praetorian?</td></tr>
<tr><td><textarea cols="20" rows="3" name="contact" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>What kind of raid experience do you have(TBC and Pre- TBC)?</td></tr>
<tr><td><textarea cols="20" rows="3" name="experience" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>Are you willing to reroll professions for the sake of guild progression and character improvement?</td></tr>
<tr><td><textarea cols="20" rows="3" name="proffession" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td>Are you able to use Ventrillo, do you have a microphone <br />and do you know how to use it?</td></tr>
<tr><td><textarea cols="20" rows="3" name="ventrilo" style="overflow: hidden; width: 450px; color : rgb(90, 97, 99); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></textarea></td></tr>
</table>
<table id="recruitment_apply">
<tr><td><INPUT TYPE="checkbox" NAME="agree" VALUE=" Yes" ></td><td style="font-size: 10px;">I have read and i agree the <a href="?pagina=recruitment_rules">recruitment rules</a> and the <a href="?pagina=raiding_rules">raiding rules</a>.</td></tr>
</table>
<table id="recruitment_apply">
<tr><td><input size="10" maxlength="10" type="Submit" name="verzend" value="Apply" style="color : rgb(173, 146, 74); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td><td><input size="10" maxlength="10" type="reset" name="reset" value="Reset" style="color : rgb(173, 146, 74); background: rgb(41, 44, 41); border: 1px solid rgb(90, 97, 99);"></td></tr>
</table>
<?php
}
?>
Gewijzigd op 01/01/1970 01:00:00 door Mike van den Berg
$_POST['specialization'] == ''
in
empty($_POST['specialization'])
Maar verder kan ik niete veel fouten vinden, probeer anders dit is bovenaan je script te zetten(binnen php tag)
Maarja, het probleem: Je hebt geen <form> aangemaakt ;)
of kan ik het totale gedeelte wat de form zou moeten betreffen tussen <form></form> plaatsen?
als ik hier namelijk
Code (php)
1
<form method="post" action="mailto:[email protected]" enctype="text/html" subject=Apply">
van maak, dan komt ie met een irritante outlook popup en dit wil ik juist niet laten zien aan mijn gasten.
hoe is dit op te lossen?
groet,
Mike
Gewijzigd op 01/01/1970 01:00:00 door Mike van den Berg
"> is goed genoeg (ook </form> natuurlijk)
<form method="post" action="<form method="post" action="">
proberen, of de PHP_SELF de get-variablen meegeven.
Hartelijk dank! het is gelukt door het bovenstaande aan te passen!
POST hoefde niet veranderd te worden voor GET variabelen, enkel de action moet "" zijn.
Nu kan ik verder met de edit ervan,
zeker veel geleerd weer,
Mijn dank is groot!