0

in this double condition [else if($test1[0] == "Regular Project" && $test1[0] == "FSA Project")] is not working properly. this is the way to do . or in_array i have to use.

   $sql1 = "SELECT Select_Type,Prj_Id,Status FROM PROJECT_ACTIVE WHERE Memr_Id='$data[0]'";
   $test = mysql_query($sql1);
   $test1 = mysql_fetch_array($test);

   /*echo "<select name='selecttype'>";
   for($i=0;$i<3;$i++)
   {
       echo " value ".$test1[0];
       echo "value 1".$a[0];
       if(in_array($test1[0], $a[i])){
           continue;
       }
       else
       {
           echo "<option value='$a[i]' >$a[i]</option>";             
       }
   }
   echo "<select>";*/




     if($test1[0] == "Regular Project"){
     echo "<select name='selecttype'>
        <option value='TGF Project'>TGF Project</option>
        <option value='FSA Project'>FSA Project</option>
        </select>";
        }

        else if($test1[0] == "FSA Project")
        {
        echo "<select name='selecttype'>
        <option value='Regular Project'>Regular Project</option>
        <option value='TGF Project'>TGF Project</option>
        </select>";
        }

        else if($test1[0] == "TGF Project")
        {
        echo "<select name='selecttype'>
        <option value='Regular Project'>Regular Project</option>
        <option value='FSA Project'>FSA Project</option>
        </select>";
        }
        else if($test1[0] == "Regular Project" && $test1[0] == "FSA Project"){
        echo "<select name='selecttype'>
        <option value='TGF Project'>TGF Project</option>
        </select>";
        }
        else if($test1[0] == "Regular Project" && $test1[0] == "TGF Project"){
        echo "<select name='selecttype'>
        <option value='FSA Project'>FSA Project</option>
        </select>";
        }
        else if($test1[0] == "FSA Project" && $test1[0] == "TGF Project"){
        echo "<select name='selecttype'>
        <option value='Regular Project'>Regular Project</option>
        </select>";
        }
        else
        {
        echo "<select name='selecttype'>
        <option value='Regular Project'>Regular Project</option>
        <option value='FSA Project'>FSA Project</option>
        <option value='TGF Project'>TGF Project</option>
        </select>";
        }
2
Contributors
5
Replies
44
Views
2 Years
Discussion Span
Last Post by malatamil
0

lets assume you have array

$test1 = array("Regular Project", "FSA Project", "TGF Project");

so when you select double condition like this
if ($test1[0] == "Regular Project" && $test1[0] == "FSA Project")
$test[0] contain one value in this moment, its either Regular Project or FSA Project so that why double condition not working.

0

How can i mention! i will use || instead of &&. i tried with ||,not getting what i expect.

0

sorry for asking,this is the right way?

else if($test1[0] == "Regular Project" ){
            if($test1[0] == "FSA Project"){
            echo "<select name='selecttype'>
            <option value='TGF Project'>TGF Project</option>
            </select>";
            }
        }
0

if($test1[0] == "Regular Project" )
in this line $test1[0] contain value "Regular Project" so its impossible to have another value "FSA Project", I suggest have another array or another variable contain other value so we can check like :
if ($test1[0] == "Regular Project" && $test2[0] == "FSA Project")

0

Thanks,Ya i checked but if the conditoin is like this

else if($test1[0] == "FSA Project" && $test_2[0] == "TGF Project"){

            echo "<option value='Regular Project'>Regular Project</option>";

        }

it should come regular project only! but this is checking single condition

else if($test1[0] == "TGF Project")
        {
        echo "<option value='Regular Project'>Regular Project</option>
        <option value='FSA Project'>FSA Project</option>";
        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.