simple formmailer - where is my mistake?

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

php-forum Active User
php-forum Active User
Posts: 32
Joined: Tue Jul 30, 2002 11:27 pm

Thu Aug 15, 2002 8:47 am

The else-message won't appear even when the email-field is empty.

<form action="<?php echo $PHP_SELF; ?>" method="post">
Bitte geben Sie Ihren Namen ein: <input type="text" name="Mail"><br><br>
Ihre Nachricht<br>
<textarea name="botschaft" cols="50" rows="5" wrap="soft">
<input type="submit" value="Mail abschicken">
if (isset($Mail) && $Mail != "") {
if (mail("", "Antwort auf Ihre Anfrage!", "$botschaft", "From: $Mail")) {
echo "<p>Danke! Ihre Nachricht wurde weitergeleitet!</p>\n";
else {
echo "<p>Leider gab es einen Sendefehler!</p>\n";

miss marple

Fri Aug 16, 2002 2:22 am

The way you've written it the else message will appear if the mail function fails!

It's obviously not failing!

And since we have a forum for this where answer have already been posted, I will close this duplicate thread.