Re: [PHP-DB] mail
[email protected] (Chris)
| Newsgroups | php.db |
|---|---|
| Message-ID | <[email protected]> |
Emiliano Boragina wrote:
> <?php
> if(isset($_POST["empresa"]) && isset($_POST["nombre"]) &&
> isset($_POST["telefono"]) && isset($_POST["mail"]) &&
> isset($_POST["asunto"]) && isset($_POST["mensaje"]) )
> {
<snip>
> I test this code to send mail, but I am testing this printing $contenido.
> If nothing is ISSET must be print "ERROR", but not, if I send de form empty
> this code print $contenido.
> It is not working, why?
Maybe the post variables are there but they are empty.
$form_vars = array('empresa', 'nombre', 'telefono');
$error = false;
foreach ($form_vars as $var) {
if (!isset($_POST[$var])) {
echo "Error - $var is missing\n";
$error = true;
break;
}
if (empty($_POST[$var])) {
echo "Error: $var is empty (no value supplied)\n";
$error = true;
break;
}
}
if ($error) {
die();
}
send_email_here();
--
Postgresql & php tutorials
http://www.designmagick.com/