Hi again,
Thanks Chris for your quickly answer. I dont test it yet.
I want to share with all you a very strange, for me, solution:
<?php
$empresa = $_POST["empresa"];
$nombre = $_POST["nombre"];
$telefono = $_POST["telefono"];
$mail = $_POST["mail"];
$asunto = $_POST["asunto"];
$mensaje = $_POST["mensaje"];
if($empresa == "" || $nombre == "" || $telefono == "" || $mail == "" ||
$asunto == "" || $mensaje == "")
{
//echo "ERROR";
header('location:contactenos.php?mensaje=error');
}
else
{
$fecha = date("d.m.y H:i");
$mymail = "[email protected]";
$subject = "my company : Contacto web<br>";
$contenido .= "Empresa: ".$_POST["empresa"]."<br>";
$contenido .= "Nombre y Apellido: ".$_POST["nombre"]."<br>";
$contenido .= "Telefono: ".$_POST["telefono"]."<br>";
$contenido .= "E-mail: ".$_POST["mail"]."<br>";
$contenido .= "Asunto: ".$_POST["asunto"]."<br>";
$contenido .= "Mensaje: ".$_POST["mensaje"]."<br>";
$contenido .= "El mensaje se escribio el ".$fecha."<br>";
$header =
"From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."<br>";
$header .= "X-Mailer:PHP/".phpversion()."\n";
$header .= "Mime-Version: 1.0\n";
$header = "Content-Type: text/html; charset=utf-8\r\n";
//mail($mymail, $subject, utf8_encode($contenido) ,$header);
//echo $contenido;
header('location:contactenos.php?mensaje=ok');
}
?>
I want to know somthing: this "||" operator is OR, and de logic in my code
is: if one of variables is empty and the rest not send the mail, it isnt?
If I want all field full with data I must to use "&&" AND operator, it isnt?
Well, if the answer is YES, I tell you: I test with "&&" and send it anyway.
I dont understand... I am right or not with my afiration?
Thanks a lot!
+ _
// Emiliano Boragina _
// Diseño & Comunicación //////////////////
+ _
// [email protected] /
// 15 40 58 60 02 ///////////////////////////
+ _
-----Mensaje original-----
De: Chris [mailto:[email protected]]
Enviado el: Miércoles, 06 de Mayo de 2009 01:08 a.m.
Para: Emiliano Boragina
CC: [email protected]
Asunto: Re: [PHP-DB] mail
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/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php