Chris wrote: > PJ wrote: >> And again, this works: >> if (strlen($_POST["first_nameIN"]) == 0 ) { >> $obligatoryFieldNotPresent = 1; ... >> >> this does not: >> >> if (strlen($_POST["first_nameIN"]) > 0 ) && >> (strlen($_POST["last_nameIN"]) > 0 ) { echo $first_nameIN, " ", >> $last_nameIN); >> else (echo "error";)} >> >> But, $first_nameIn and $last_nameIN do echo their contents without the >> if clause and we see that the first if clause does work... what am I >> doing wrong, again? > > Firstly please learn to indent your code (I don't care if this is just > an example of your code, make it easier for everyone who's trying to > help you). It's much easier to read this: > > if (strlen($_POST["first_nameIN"]) > 0 ) && > (strlen($_POST["last_nameIN"]) > 0 ) { > echo $first_nameIN, " ", $last_nameIN; > } else { > echo "error"; > } > > If you want help we're not going to spend a long time reformatting > your code to try and understand it. My apologies. Sometimes, I get all excited and don't pay attention. I'll change, promise... > > > Now to the problem. > > Are both first_nameIN AND last_nameIN longer than 0 chars? > > var_dump($_POST['first_nameIN']); > var_dump($_POST['last_nameIN']); > > maybe you only filled in first_name or last_name but not both. > Well, echo $first_nameIN, " ", $last_nameIN; Prints out the whole name - without the if clause; and I've tried several variations of ifs - none work. Maybe there is something I don't understand about 'first_nameIN' and $first_nameIN but $first_nameIN = $_POST["first_nameIN"]; has been declared beforehand. -- unheralded genius: "A clean desk is the sign of a dull mind. " ------------------------------------------------------------- Phil Jourdan --- pj@xxxxxxxxxxxxx http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php