RE: mail
am 05.05.2009 19:31:10 von Gautam Bhatia
hello,
Yes you are right, the || operator stands for OR , which means ,
if any of those listed fields are empty, do not process the form and
throw a error message instead. If you use && instead of || , it instruct
the php other way around as in , if ($field == "" && $field1 == "") or
otherfield, only process the form , if all these form fields are empty
and not just one. I hope that helps. good luck.
Regards,
Gautam Bhatia
On Wed, 2009-05-06 at 02:25 -0300, Emiliano Boragina wrote:
> 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:
>
>
> $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.boragina@gmail.com";
> $subject = "my company : Contacto web
";
> $contenido .= "Empresa: ".$_POST["empresa"]."
";
> $contenido .= "Nombre y Apellido: ".$_POST["nombre"]."
";
> $contenido .= "Telefono: ".$_POST["telefono"]."
";
> $contenido .= "E-mail: ".$_POST["mail"]."
";
> $contenido .= "Asunto: ".$_POST["asunto"]."
";
> $contenido .= "Mensaje: ".$_POST["mensaje"]."
";
> $contenido .= "El mensaje se escribio el ".$fecha."
";
> $header =
> "From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."
";
> $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.boragina@gmail.com /
> // 15 40 58 60 02 ///////////////////////////
> + _
>
> -----Mensaje original-----
> De: Chris [mailto:dmagick@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:
> >
> > if(isset($_POST["empresa"]) && isset($_POST["nombre"]) &&
> > isset($_POST["telefono"]) && isset($_POST["mail"]) &&
> > isset($_POST["asunto"]) && isset($_POST["mensaje"]) )
> > {
>
>
>
> > 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/
>
>
Regards,
Gautam Bhatia .
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
mail
am 06.05.2009 06:02:48 von Emiliano Boragina
if(isset($_POST["empresa"]) && isset($_POST["nombre"]) &&
isset($_POST["telefono"]) && isset($_POST["mail"]) &&
isset($_POST["asunto"]) && isset($_POST["mensaje"]) )
{=09
$fecha =3D date("d.m.y H:i");
$mymail =3D "emilino.boragina@gmail.com";
$subject =3D "MEGGA INSUMOS SRL : Contacto web
";=20
$contenido .=3D "Empresa: ".$_POST["empresa"]."
";
$contenido .=3D "Nombre y Apellido: ".$_POST["nombre"]."
";
$contenido .=3D "Telefono: ".$_POST["telefono"]."
";
$contenido .=3D "E-mail: ".$_POST["mail"]."
";
$contenido .=3D "Asunto: ".$_POST["asunto"]."
";
$contenido .=3D "Mensaje: ".$_POST["mensaje"]."
";
$contenido .=3D "El mensaje se escribio el ".$fecha."
";=20
$header =3D
"From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."
";
$header .=3D "X-Mailer:PHP/".phpversion()."\n";=20
$header .=3D "Mime-Version: 1.0\n";=20
$header =3D "Content-Type: text/html; charset=3Dutf-8\r\n";
//mail($mymail, $subject, utf8_encode($contenido) ,$header);
=09
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
+ =A0 =
=A0=
=A0=
=A0 _
// Emiliano Boragina _
// Dise=F1o & Comunicaci=F3n //////////////////
+ =A0 =
=A0=
=A0=
=A0 _
// emiliano.boragina@gmail.com=A0 /
// 15 40 58 60 02 ///////////////////////////
+ =A0 =
=A0=
=A0=
=A0 _
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: mail
am 06.05.2009 06:08:06 von dmagick
Emiliano Boragina wrote:
>
> if(isset($_POST["empresa"]) && isset($_POST["nombre"]) &&
> isset($_POST["telefono"]) && isset($_POST["mail"]) &&
> isset($_POST["asunto"]) && isset($_POST["mensaje"]) )
> {
> 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: mail
am 06.05.2009 07:25:16 von Emiliano Boragina
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:
$empresa =3D $_POST["empresa"];
$nombre =3D $_POST["nombre"];
$telefono =3D $_POST["telefono"];
$mail =3D $_POST["mail"];
$asunto =3D $_POST["asunto"];
$mensaje =3D $_POST["mensaje"];
if($empresa == "" || $nombre == "" || $telefono == "" || =
$mail == "" ||
$asunto == "" || $mensaje == "")
{
//echo "ERROR";
header('location:contactenos.php?mensaje=3Derror');
}
else
{
$fecha =3D date("d.m.y H:i");
$mymail =3D "emilino.boragina@gmail.com";
$subject =3D "my company : Contacto web
";=20
$contenido .=3D "Empresa: ".$_POST["empresa"]."
";
$contenido .=3D "Nombre y Apellido: ".$_POST["nombre"]."
";
$contenido .=3D "Telefono: ".$_POST["telefono"]."
";
$contenido .=3D "E-mail: ".$_POST["mail"]."
";
$contenido .=3D "Asunto: ".$_POST["asunto"]."
";
$contenido .=3D "Mensaje: ".$_POST["mensaje"]."
";
$contenido .=3D "El mensaje se escribio el ".$fecha."
";=20
$header =3D
"From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."
";
$header .=3D "X-Mailer:PHP/".phpversion()."\n";=20
$header .=3D "Mime-Version: 1.0\n";=20
$header =3D "Content-Type: text/html; charset=3Dutf-8\r\n";
//mail($mymail, $subject, utf8_encode($contenido) ,$header);
=09
//echo $contenido;
header('location:contactenos.php?mensaje=3Dok');
}
?>
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=F1o & Comunicaci=F3n //////////////////
+ =
_
// emiliano.boragina@gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ =
_
-----Mensaje original-----
De: Chris [mailto:dmagick@gmail.com]=20
Enviado el: Mi=E9rcoles, 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:
>
> if(isset($_POST["empresa"]) && isset($_POST["nombre"]) &&
> isset($_POST["telefono"]) && isset($_POST["mail"]) &&
> isset($_POST["asunto"]) && isset($_POST["mensaje"]) )
> {=09
> 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 =3D array('empresa', 'nombre', 'telefono');
$error =3D false;
foreach ($form_vars as $var) {
if (!isset($_POST[$var])) {
echo "Error - $var is missing\n";
$error =3D true;
break;
}
if (empty($_POST[$var])) {
echo "Error: $var is empty (no value supplied)\n";
$error =3D true;
break;
}
}
if ($error) {
die();
}
send_email_here();
--=20
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: mail
am 06.05.2009 07:32:16 von dmagick
> if($empresa == "" || $nombre == "" || $telefono == "" || $mail == "" ||
> $asunto == "" || $mensaje == "")
> {
> 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