You are here: Re: Check if any fields are filled in « PHP Programming Language « IT news, forums, messages
Re: Check if any fields are filled in

Posted by Lars Eighner on 11/06/07 18:38

In our last episode,
<1194372034.748781.192620@o38g2000hse.googlegroups.com>, the lovely and
talented mtuller broadcast on comp.lang.php:

> On Nov 6, 11:41 am, Good Man <he...@letsgo.com> wrote:
>> mtuller <mitul...@gmail.com> wrote innews:1194370693.692490.11330@19g2000hsx.googlegroups.com:
>>
>> > When I submit, if I have data in one field, but not in all, it
>> > displays "The fields are empty". I want it to submit into the database
>> > if any fileds are filled in, but not if there are no fields filled in.
>>
>> but one post ago you said:
>>
>> "Sorry, the subject of this is wrong. I don't want to check if any
>> fields are empty. I want to check if all are empty. That's why I have
>> &&."
>>
>> So decide what exactly you are trying to do, and then pick either of the
>> solutions posted.

> 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.

Good grief, don't they teach programmers any symbolic logic anymore?

All fields empty is the same as not(one of them is filled in).

> If any of the fields have data though, I want it to be submitted. That is
> why I am checking with &&.

But obviously that is wrong.

> If $nominee_first_name AND $nominee_middle_initial AND $nominee_last_name
> are all empty, echo "The fields are empty".

If $nominee_first_name AND $nominee_middle_initial AND
$nominee_last_name are all empty = If not($nominee_first_name is empty OR
$nominee_middle_initial is empty OR $nominee_last_name is empty)

> If any are filled in, then submit to the database.

> Hope that explains better.

--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 440 days to go.
What do you do when you're debranded?

 

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

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