[PHP-DB] mail
?php if(isset($_POST[empresa]) isset($_POST[nombre]) isset($_POST[telefono]) isset($_POST[mail]) isset($_POST[asunto]) isset($_POST[mensaje]) ) { $fecha = date(d.m.y H:i); $mymail = emilino.borag...@gmail.com; $subject = MEGGA INSUMOS SRL : Contacto webbr; $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; }else{ echo ERROR; } ? 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? I am using a server (Appserv) in Windows + _ // Emiliano Boragina _ // Diseño Comunicación // + _ // emiliano.borag...@gmail.com / // 15 40 58 60 02 /// + _ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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
RE: [PHP-DB] mail
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 = emilino.borag...@gmail.com; $subject = my company : Contacto webbr; $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 // + _ // emiliano.borag...@gmail.com / // 15 40 58 60 02 /// + _ -Mensaje original- De: Chris [mailto:dmag...@gmail.com] Enviado el: Miércoles, 06 de Mayo de 2009 01:08 a.m. Para: Emiliano Boragina CC: php-db@lists.php.net 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
Re: [PHP-DB] mail
if($empresa == || $nombre == || $telefono == || $mail == || $asunto == || $mensaje == ) { snip 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? Looks like it to me. 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. It would only not send if *ALL* were empty this way. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php