Formmail Script PHP
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<form action="sendmail.php" method="post">
<p>Choose a Category</p>
<SELECT NAME="category">
<option value="Server">Server
<option value="Forum">Forum
<option value="Website">Website
<option value="Other">Other
</select>
<p>Your Name:</p>
<input type="text" name="name">
<p>Your E-mail:</p>
<input type="text" name="mail">
<p>Your comment:</p>
<textarea name="comment" rows="7" cols="40">
</textarea>
<br>
<input type="submit" value="Send Message"><input type="reset" value="Clear">
</form>
<p>Choose a Category</p>
<SELECT NAME="category">
<option value="Server">Server
<option value="Forum">Forum
<option value="Website">Website
<option value="Other">Other
</select>
<p>Your Name:</p>
<input type="text" name="name">
<p>Your E-mail:</p>
<input type="text" name="mail">
<p>Your comment:</p>
<textarea name="comment" rows="7" cols="40">
</textarea>
<br>
<input type="submit" value="Send Message"><input type="reset" value="Clear">
</form>
Gewijzigd op 24/09/2011 23:09:25 door Ozzie PHP
Het werkt helemaal!
Hatstikke bedankt voor al je hulp en inzet.
Ik zal de FORM nog eens goed gaan leren.
MVG,
Ivan Heerkens
graag gedaan en succes ermee! :)
Toevoeging op 25/09/2011 14:59:26:
Toch niet helemaal de oplossing via MSN gekregen...
Wat ik wilde = De optie die de mensen kiezen voor de Nieuwsbrief ontvangen kunnen inzien als ze de mail sturen, Ik heb de variabelen erin gezet, maar hij werkt niet.
Alles wat hij mee stuurt met de mail, is zichtbaar, behalve dus die keuze van de nieuwsbrief,
HTML Code van de Form =
Quote:
<form action="sendmail.php" method="post" name="form1">
<p>Choose a Category</p>
<SELECT NAME="category">
<option value="Server">Server
<option value="Forum">Forum
<option value="Website">Website
<option value="Other">Other
</select><br><br>
<p>Your Name:</p>
<input type="text" name="name">
<br><br>
<p>Your E-mail:</p>
<input type="text" name="mail">
<br><br>
<p>Your comment:</p>
<textarea name="comment" rows="7" cols="40">
</textarea>
<br><br>
<p>Do you want to receive our newsletter?:</p>
<input type="radio" name="newsletter" VALUE="Yes">Yes
<input type="radio" name="newsletter" VALUE="No">No
<br><br>
<INPUT TYPE="IMAGE" SRC="images/submit.jpg"> <input type="image" src="images/clear.jpg" onclick="document.form1.reset(); return false;">
</form>
<p>Choose a Category</p>
<SELECT NAME="category">
<option value="Server">Server
<option value="Forum">Forum
<option value="Website">Website
<option value="Other">Other
</select><br><br>
<p>Your Name:</p>
<input type="text" name="name">
<br><br>
<p>Your E-mail:</p>
<input type="text" name="mail">
<br><br>
<p>Your comment:</p>
<textarea name="comment" rows="7" cols="40">
</textarea>
<br><br>
<p>Do you want to receive our newsletter?:</p>
<input type="radio" name="newsletter" VALUE="Yes">Yes
<input type="radio" name="newsletter" VALUE="No">No
<br><br>
<INPUT TYPE="IMAGE" SRC="images/submit.jpg"> <input type="image" src="images/clear.jpg" onclick="document.form1.reset(); return false;">
</form>
Email Script PHP =
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
// your email address
$youremail = "[email protected]";
// field validation
if ($_POST['mail']=="" || $_POST['comment']=="" || $_POST['newsletter']=="" || $_POST['name']=="")
{
print ("All fields are required! Please go back and try again.");
}
else {
// send email
$headers = 'From: "' . $_POST['name'] . '" <' . $_POST['mail'] . '>' . "\n";
$subject = "Contact Form";
$message = $_POST['newsletter'], $_POST['comment'];
mail ("$youremail", "$subject", $message, $headers);
print ("Thank you $name, your email has been sent.");
}
?>
// your email address
$youremail = "[email protected]";
// field validation
if ($_POST['mail']=="" || $_POST['comment']=="" || $_POST['newsletter']=="" || $_POST['name']=="")
{
print ("All fields are required! Please go back and try again.");
}
else {
// send email
$headers = 'From: "' . $_POST['name'] . '" <' . $_POST['mail'] . '>' . "\n";
$subject = "Contact Form";
$message = $_POST['newsletter'], $_POST['comment'];
mail ("$youremail", "$subject", $message, $headers);
print ("Thank you $name, your email has been sent.");
}
?>
Gewijzigd op 25/09/2011 12:22:24 door Ivan Heerkens