simple formmailer - where is my mistake?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

simple formmailer - where is my mistake?

Postby Miss_Marple » 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">
</textarea><br>
<input type="submit" value="Mail abschicken">
</form>
<?php
if (isset($Mail) && $Mail != "") {
if (mail("don_martin@hotmail.com", "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

Jay

Postby Jay » 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.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 3 guests