Thanks everyone helped me (Aaron Bennett specialy) with the
"input checking problem". Maybe Rip's idea of mixing javascript
and php is a good one but I'm newbie and I'm not sure which
languaje takes the control first or how the interact.

Anyway I'll work in that direction later

Hasta la proxima

Aniceto López

here is the "form that sends a mail but chek if all the inputs
were filled in" in case anybody wants to use it

<title>mail send</title>
<body bgcolor="#FFFFFF">

<form name="emailer"action="<?php echo($PHP_SELF); ?>" method="post">
For:         <input size="26" name="for" value="<?= $for ?>"><br>
Your name: <input size="26" name="name" value="<?= $name ?>"><br>
Your email:     <input size="26" name="mail" value="<?= $mail ?>"><br>
Subjet:     <input size="26" name="subject" value="<?= $subject ?>"><br>
Text:<br> <textarea rows="8" cols="20" name="text"><?= $text
<input type="submit" name="submit" value="send">
<? if (isset($errmsg)) { ?> <?=$errmsg?><br> <? } ?>

$headers = "From: " . $name . " <" . $mail . ">";
$headers .= "\nContent-Type: text/html; charset=iso-8859-1\n";
$headers .= "X-Mailer: PHP\n";

if ($submit)
    if ((!$for) || (!$name) || (!$mail) || (!$subject) || (!$text))
        $submit = false;
        if (!$for) { $errormsg = "Recipient email<br>"; }
        if (!$name) { $errormsg .= "Your name<br>"; }
        if (!$mail) { $errormsg .= "Your email<br>"; }
        if (!$subject) { $errormsg .= "The subject<br>"; }
        if (!$text) { $errormsg .= "Some text<br>"; }
        print("<b>Following missed data</b><br>");
    } else {
    print("Mail sended!");
    mail("$for", "$subject", "$text", "$headers");

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to