title: Yii - something wrong with if & else if statement in view file
body: <p>I'm having a problem with else if statement in my view file.</p>
  
  <p>I'm using Yii framework and I have the following code in my view file.</p>
  
  <pre><code>&lt;select class="formRightPulldown" name="Post[password]"&gt;    
  &lt;?php foreach($passwordData as $password) :?&gt;
  
  &lt;option value="&lt;?php echo $password['id'] ?&gt;" 
      &lt;?php if(isset($updateErrorPost) &amp;&amp; 
               $updateErrorPost['password']==$password['id']){
               echo 'selected';  
            } else if(isset($postUpdate) &amp;&amp; 
               $postUpdate['password']==$password['id']){
               echo 'selected'; } ?&gt;
   &gt;
       &lt;?php echo $password['name'] ?&gt;
   &lt;/option&gt;
  
  &lt;?php endforeach ;?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I believe when "$updateErrorPost" is set to be true, it shouldn't read the code after "else if".</p>
  
  <p>But somehow, even when "$updateErrorPost" is set to be true, it reads the code after "else if", so that "selected" value is added to multiple option tags.</p>
  
  <p>Does anyone knows what's causing this problem?</p>
  
  <p>Am I misunderstanding something very basic in php programming???</p>
  
  <p>Please give me a help!</p>
  
  <p>Thanks in advance :)</p>
  
  <p><em><strong>+++Added+++</em></strong></p>
  
  <p>It ends up adding selected value to multiple option tags like the below...</p>
  
  <pre><code>&lt;select class="formRightPulldown" name="Post[password]"&gt;
      &lt;option value="3"&gt;temporary&lt;/option&gt;
      &lt;option value="2" selected&gt;Subscriber&lt;/option&gt;
      &lt;option value="1" selected&gt;VIP&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>In the code above, the first selected value is added when the first if-statement is true, and the second selected value is added when the else-if-statement is true.</p>
  
  <p>Why although if-statement is true, code after else-if is read???</p>