checking a var for matches against an array
===

First off I know this is a duplicate question that is asked on here fairly often, however I have perused through those answers and still can't figure out what is wrong with my code. I am fairly new to PHP, and I am 99% sure this is a very easy/novice thing to accomplish, which is why it's frustrating me.


Here is the code:

        $validProgram = 0;
    $validProgramCodes = array('ITFZ', 'ITFC', 'ITFP', 'ITFE', 'ITFL', 'ITFS',
                               'ITFF', 'ITFM', 'ITFT', 'IEME', 'ISMK', 'IPKT');
    
    if ( isset( $_GET[ 'category' ] ) && isset( $_GET[ 'subcategory' ] )
        && $_GET[ 'category' ] != '' && $_GET[ 'subcategory' ] != '' )
    {
        $selectedSchool = $_GET[ 'category' ];
        $selectedProgram = $_GET[ 'subcategory' ];
        $selectedSchool = prepString( $selectedSchool );
        $selectedProgram = prepString( $selectedProgram );
        
        foreach ( $validProgramCodes as $temp )
        {
            if ( $temp == $selectedProgram )
            {
                $validProgram = 1;
            }
        }
        
        if ( $validProgram = 1 )
        {
            echo "success!";
        }
        else
        {
            echo "failure!";
        } 
    }
}



Now... for some reason, no matter what is supplied for $selectedProgram, the validation check echos out the success statement. This is really simple code so I'm sure it's something glaringly obvious, but I think I just need another pair of eyes to give it a quick glance over. :)

Thank you for any help!