Jump to content

Unexpected T_BOOLEAN_AND, expecting ')'


TottoBennington

Recommended Posts

I can't found the error

 

<?php 
$submit = @ $_POST['submit'];
if ($submit) 
{
     $nombre = strtolower( strip_tags(@ $_POST['nombre']));
     $apellido = strtolower( strip_tags( @ $_POST['apellido']));
     $tel = strip_tags(@ $_POST['telefono']);
     $email = strip_tags(@ $_POST['email']);
     $ubicacion = strtolower( strip_tags( @ $_POST['ubicacion']));
     $opcion = @ $_POST['opcion'];
     $especificacion = strtolower( strip_tags( @ $_POST['especificacion']));
     $explicación = strtolower( strip_tags( @ $_POST['explicacion'])); 

 if (!empty($nombre&&$apellido&&$email&&$tel&&$ubicacion&&$opcion&&$especificacion&&$explicacion))
 {
 mysql_connect ("localhost","root","") or die (mysql_error());
     mysql_select_db("pedidos") or die (mysql_error());

 $date = date ("Y-m-d");
 $insert = mysql_query ("INSERT INTO pedidos_recibidos VALUES ('','$nombre','$apellido','$tel','$email','$ubicacion','$opcion','$especificacion','$explicacion','$date')") or die (mysql_error());
 }
 else 
 {
     echo "please fill out all the fields";
 }
}
?>

Link to comment
https://forums.phpfreaks.com/topic/256398-unexpected-t_boolean_and-expecting/
Share on other sites

First off, don't use '@' to suppress errors or notices.  Fix them instead. 

 

Your problem is your attempted use of empty.  The error message is VERY descriptive.  It told you to look for "unexpected use of AND".  Your code uses '&&" in one place, so clearly that's the place to look -- inside the empty().

 

You can't pass in a bunch of && variables there, and if you think about it, it doesn't really make sense.  I suppose if you want to continue with that, what you should do is:

 

if (!empty($nombre) && !empty($apellido) && ... etc)

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.