Re: I really don't understand this?

From: Date: Sun, 06 Apr 2003 20:34:30 +0000
Subject: Re: I really don't understand this?
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-19324@lists.php.net to get a copy of this message
Well, in my opinion this piece of script doesn't work because in the 2nd and 3rd elseif the variable $duplicate is not set or if set is empty... You could try to put the assignment $duplicate = duplicate_name($form["name"]) before performing the three if statements, use the same condition used in the first one also in the two following ones or compare directly the value returned by the function like: if (duplicate_name($form["name"]) =="T"){...} Otherwise why not use a switch statement, instead? It should sound like this: if (empty($form["name"])) { $error["name"] = "*"; $message["name"] = "Required field!"; } else{ $duplicate = duplicate_name($form["name"]) switch ($duplicate) { case "T": ... case "D": ... case "S": ... } } I hope my help could be useful to you Francesco PS Mail me directly if it works as I suggested ;)

« previous php.windows (#19324) next »