PDA

View Full Version : Question about if condition



newphpbees
27 Jan 2011, 07:25 PM
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:


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

Jason
28 Jan 2011, 08:11 AM
I don't really understand what you saying.

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


if($_POST["from1_date"] && $_POST["to1_date"])

if that doesn't do what you need can you try to explain the problem better.