Connecting Tech Pros Worldwide Help | Site Map

Control Structures

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 10:49 AM
[Mystic]
Guest
 
Posts: n/a
Default Control Structures

I was just wondering. Im submitting a form, using this code:

if ((!empty($_POST['Name']) || !empty($_POST['E-Mail']) ||
!empty($_POST['Question'])) {

code...

}

What im testing for is

if name, email or question is set, do the following. But it is not working,
do I have the syntax right?

Also where is the document on the php site that explains || and &&

Thanks.



  #2  
Old July 17th, 2005, 10:49 AM
floele@gmail.com
Guest
 
Posts: n/a
Default Re: Control Structures

>do I have the syntax right?

No, one "(" too much ;)

if (!empty($_POST['Name']) || !empty($_POST['E-Mail']) ||
!empty($_POST['Question'])) {

code...

}
[color=blue]
>Also where is the document on the php site that explains || and &&[/color]
http://www.php.net/manual/en/languag...rs.logical.php

  #3  
Old July 17th, 2005, 10:49 AM
Jacob Atzen
Guest
 
Posts: n/a
Default Re: Control Structures

On 2005-01-19, [Mystic] <> wrote:[color=blue]
> I was just wondering. Im submitting a form, using this code:
>
> if ((!empty($_POST['Name']) || !empty($_POST['E-Mail']) ||
> !empty($_POST['Question'])) {
>
> code...
>
> }
>
> What im testing for is
>
> if name, email or question is set, do the following. But it is not working,
> do I have the syntax right?[/color]

It looks right. What is the expected result? What is the actual result?
Are you sure, your $_POST array contains, what you expect it to contain?
[color=blue]
> Also where is the document on the php site that explains || and &&[/color]

<http://www.php.net/manual/en/language.operators.logical.php>

--
Cheers,
- Jacob Atzen
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.