Connecting Tech Pros Worldwide Help | Site Map

Control Structures

  #1  
Old July 17th, 2005, 11:49 AM
[Mystic]
Guest
 
Posts: n/a
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, 11:49 AM
floele@gmail.com
Guest
 
Posts: n/a

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, 11:49 AM
Jacob Atzen
Guest
 
Posts: n/a

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
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Multiple variable control in for loops. Doable in Python? Derek Martin answers 0 July 18th, 2008 10:35 PM
Similarities and differencest between control structures artsaulon answers 2 January 28th, 2008 05:07 PM
Control structures pgt answers 2 November 6th, 2007 08:05 PM
problem with control structures ( if and next) varala_kanth answers 3 July 19th, 2005 06:05 AM