how to check if the required fields were filled in without the text in them?
| From: | Aniceto Lopez | Date: | Thu, 12 Jul 2001 15:59:48 +0000 |
| Subject: | how to check if the required fields were filled in without the text in them? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-57606@lists.php.net to get a copy of this message | ||
Hola everybody;
this is a simple form to send a mail via php, check if a field
was filled in and prompt an error msg (if not) is easy but
when the Submit button is presssed the text in the rest of
the fields dessapear.
How to avoid fields draining if one of them is no filled in?
thanks
Ani López
<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"><br>
your name: <input size="26" name="name"><br>
your email: <input size="26" name="mail"><br>
tex:<br>
<textarea name="texto" rows="8"
cols="20"></textarea><br>
<input type="submit" name="submit" value="enviar">
</form>
<?php
$subjet = "Welcome home [ www.lamundial.net ]";
$headers = "From: " . $name . " <" . $mail . ">";
$headers .= "\nContent-Type: text/html; charset=iso-8859-1\n";
$headers .= "X-Mailer: PHP\n";
if ($submit) {
mail("$for", "$subjet", "$text", "$headers");
}
?>
</body>
</html>