Posted by Janwillem Borleffs on 06/26/06 22:47
Ian Davies wrote:
> if ((isset($_POST['Link']) && $_POST['Link'] !=='') &&
> (isset($_POST['uploadedfile']) && $_POST['uploadedfile'] !=='')) {
> $error_msg.="<br>You can't select to upload a link and a file at the
> same time.";
>
This way, the condition only applies when both sub-conditions are true (both
fields are non-empty); replace the && between the sub-conditions with ||
if ((isset($v) && $v !=='') || (isset($v2) && $v2 !=='')) {
...
}
> curiously the following works
>
> if(empty($_POST['Link']) || $_POST['Link'] ='' &&
> empty($_FILES['uploadedfile']) || $_FILES['uploadedfile'] ='') {
> $error_msg.="<br>You didn't select whether to upload a link or a
> file."; }
>
That's because with the ||, only one test has to pass. Also note that you
are not compatring values (==) but assigning them (=).
JW
Navigation:
[Reply to this message]
|