If and else statement in PHP inside of an echo : <p>I want to give the admin the ability to activate the user account so I have to status active and inactive
When I run my code I get 4 status
Active 
Inactive 
Active 
Inactive 
You will find here a screenshot to understand the problem I’m facing </p>

<p><a href="http://i.imgur.com/2c0VcN7.png" rel="nofollow">http://i.imgur.com/2c0VcN7.png</a></p>

<pre><code>    if(isset($_GET['id_user'])){

        include("conexion.php");

        $rep=$db-&gt;query("select * from user WHERE id_user=" .$_GET['id_user']  );

        while($l=$rep-&gt;fetch()){
echo "

&lt;form class= mainSettingsForm add method='POST'&gt;


    &lt;label&gt;Numero utlisateur :&lt;/label&gt;
    &lt;input disabled='disabled' type='text' name='ref' value=' ".$l[0]." ' &gt;&lt;/input&gt; 
    &lt;input name='id_user2' type='hidden' value='".$l[0]."' &gt;&lt;/input&gt; 

    &lt;label&gt;Nom utlisateur :  &lt;/label&gt;    
    &lt;input type='text' name='username2' value='".$l[1]."' &gt; 

    &lt;label&gt; nom :    &lt;/label&gt;   
    &lt;input type='text' name='nom2' value='".$l[3]."' &gt; 

    &lt;label&gt; prenom :      &lt;/label&gt;
    &lt;input type='text' name='prenom2' value='".$l[4]."' &gt; 

    &lt;label&gt; Statut :  &lt;/label&gt;    
    &lt;select name=statut &gt;


      if ($l[6] ==active) {
      echo '
      &lt;option value=active &gt;active&lt;/option&gt;
      &lt;option value=inactive &gt;inactive&lt;/option&gt;  }'

      else {
      echo '
      &lt;option value=inactive &gt;inactive&lt;/option&gt;      
      &lt;option value=active &gt;active&lt;/option&gt; }'

        &lt;/select&gt;



   &lt;input class=btn-primary type='submit' name='enregistrer' value='enregistrer' &gt; 

    &lt;/form&gt;"; // fin echo
    }   
    }
?&gt; 
</code></pre>
