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

<html>
<head>
<title>mail send</title>
</head>
<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
?></textarea><br>
<input type="submit" name="submit" value="send">
</form>
<br>
<? if (isset($errmsg)) { ?> <?=$errmsg?><br> <? } ?>

<?php
$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>");
        print($errormsg);
    } else {
    print("Mail sended!");
    mail("$for", "$subject", "$text", "$headers");
    }
}
?>
</body>
</html>



-- 
PHP General Mailing List (http://www.php.net/)
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