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
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)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.