Results 1 to 2 of 2

Thread: Question about if condition

  1. #1
    Join Date
    Sep 2010
    Posts
    188

    Question about if condition

    Good day!

    I have if condition in my code and it is for checking the input data from the user or client.

    Here is my if statement:
    PHP Code:
    if($_POST["from1_date"] && $_POST["to1_date"] && $_POST["shift1"]) 

    this code is work when i insert in the text field the from date, to date and the shift. I have 3 types of shift. For example I input from 2011-01-01 to 2011-01-02 shift 1-6 all the data that the shift is 1-6 is appear. My problem now is when i did not input shift no data was appear. I want to happen is when I did not input shift all the data from date to date will appear.

    Any help is highly appreciated.

    Thank you

  2. #2
    Join Date
    Mar 2007
    Location
    Werrington, England
    Posts
    1,315
    I don't really understand what you saying.

    If you want the shift feel to be optional you could have the following if statement.

    PHP Code:
    if($_POST["from1_date"] && $_POST["to1_date"]) 
    if that doesn't do what you need can you try to explain the problem better.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •