You are here: Re: testing the condition of a pair of fields « All PHP « IT news, forums, messages
Re: testing the condition of a pair of fields

Posted by Martin Jay on 10/10/42 11:51

In message <vQXng.12609$SO4.3559@newsfe3-win.ntli.net>, Ian Davies
<iandan.dav@virgin.net> writes
>Can anyone tell me why the following code will NOT work
>The error message should be displayed when there is something in both fields
>
> 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.";

Here you're using $_POST['uploadedfile']. I'd guess it should probably
be $_FILES['uploadedfile']['name'], which is the name of the file that
was uploaded.

>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.";
> }

Here you're using $_FILES['uploadedfile'], which would be an array.

And $_POST['Link'] ='' will always be true because it is giving
$_POST['Link'] the value ''.
--
Martin Jay
Phone/SMS: +44 7740 191877
Fax: +44 870 915 2124

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация