Control Structures

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • [Mystic]

    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.


  • floele@gmail.com

    #2
    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]


    Comment

    • Jacob Atzen

      #3
      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.operat ors.logical.php >

      --
      Cheers,
      - Jacob Atzen

      Comment

      Working...