Reply to Re: Check if any fields are filled in

Your name:

Reply:


Posted by Good Man on 11/06/07 21:28

mtuller <mituller@gmail.com> wrote in news:1194384049.997043.5250@
19g2000hsx.googlegroups.com:

> On Nov 6, 1:14 pm, Michael Fesser <neti...@gmx.de> wrote:
>> .oO(mtuller)
>>
>> >Ok. I see where it sounds like I am saying different things, but I
am
>> >not. Let me try again...
>>
>> >I want to check to see if ALL fields are empty, and if they are, the
>> >form is not submitted into the database. If any of the fields have
>> >data though, I want it to be submitted. That is why I am checking
with
>> >&&. If $nominee_first_name AND $nominee_middle_initial AND
>> >$nominee_last_name are all empty, echo "The fields are empty". If
any
>> >are filled in, then submit to the database.
>>
>> >Hope that explains better.
>>
>> The solution was already posted:
>>
>> <news:1194365743.911855.266720@50g2000hsm.googlegroups.com>
>>
>> Micha
>
> Just my luck today. The link you gave me says it can't be found.
>

Only because it's sooooo very painful to watch you struggle... note that
you know exactly what you want, in fact up above you've specified it in
coding terms!!!!!!

if(($nominee_first_name=="") && ($nominee_middle_initial=="") &&
($nominee_last_name=="")) {
echo "The fields are empty.";
}
else {
enterTheDamnCode();
}

Notice how the clause is EXACTLY WHAT YOU WERE SAYING IN PLAIN ENGLISH
UP ABOVE!!!!!!


Now, to add a bit of insight as to why this got confusing for you - at
first you were checking for NOT empty:

if ($nominee_first_name !=='' && $nominee_middle_initial !=='' &&
$nominee_last_name !=='')

.... and in that case, you would use || ("or") and reverse the call:

if ($nominee_first_name !='' || $nominee_middle_initial !='' ||
$nominee_last_name !='') {
enterTheDamnCode();
}
else {
echo "The fields are empty.";
}

[Back to original 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

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